Skip to content

Commit

Permalink
feat(laravel): laravel component (#5882)
Browse files Browse the repository at this point in the history
* feat(laravel): laravel component

* try to skip laravel

* feat(jsonapi): component

* feat(laravel): json api support (needs review)

* work on relations

* relations (needs toMany) + skolem + IRI to resource

* links handler

* ulid

* validation

* slug post

* remove deprecations

* move classes

* fix tests

* fix tests metadata

* phpstan

* missing class

* fix laravel tests

* fix stan
  • Loading branch information
soyuka authored Jun 25, 2024
1 parent d2e2280 commit 0d5f356
Show file tree
Hide file tree
Showing 311 changed files with 95,730 additions and 1,388 deletions.
1 change: 1 addition & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
2,
"always",
[
"laravel",
"symfony",
"doctrine",
"metadata",
Expand Down
47 changes: 45 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ jobs:
run: |
./vendor/bin/phpstan --version
./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
- name: Install Laravel
run: |
composer api-platform/laravel update
composer api-platform/laravel run-script build
- name: Run PHPStan analysis (laravel)
working-directory: 'src/Laravel'
run: |
./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
Expand Down Expand Up @@ -955,7 +963,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo
coverage: none
ini-values: memory_limit=-1
# Not in pecl
Expand Down Expand Up @@ -1006,7 +1014,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo
coverage: none
ini-values: memory_limit=-1
# Not in pecl
Expand Down Expand Up @@ -1333,3 +1341,38 @@ jobs:
name: openapi-docs-php${{ matrix.php }}
path: build/out/openapi
continue-on-error: true

laravel:
name: Laravel (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '8.2'
- '8.3'
include:
- php: '8.2'
coverage: true
- php: '8.3'
coverage: true
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
ini-values: memory_limit=-1
- name: Run ${{ matrix.component }} install
run: |
composer update
composer api-platform/laravel update
- name: PHP version tweaks
run: |
composer run-script build
composer run-script test
working-directory: 'src/Laravel'
22 changes: 19 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,17 @@
"friends-of-behat/mink-extension": "^2.2",
"friends-of-behat/symfony-extension": "^2.1",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"illuminate/config": "^10.0||^11.0",
"illuminate/contracts": "^10.0||^11.0",
"illuminate/database": "^10.0||^11.0",
"illuminate/http": "^10.0||^11.0",
"illuminate/pagination": "^10.0||^11.0",
"illuminate/routing": "^10.0||^11.0",
"illuminate/support": "^10.0||^11.0",
"jangregor/phpstan-prophecy": "^1.0",
"justinrainbow/json-schema": "^5.2.1",
"laravel/framework": "^10.0||^11.0",
"orchestra/testbench": "^8.18",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpdoc-parser": "^1.13",
Expand Down Expand Up @@ -141,7 +150,10 @@
"autoload-dev": {
"psr-4": {
"ApiPlatform\\Tests\\": "tests/",
"App\\": "tests/Fixtures/app/var/tmp/src/"
"App\\": "tests/Fixtures/app/var/tmp/src/",
"Workbench\\App\\": "src/Laravel/workbench/app/",
"Workbench\\Database\\Factories\\": "src/Laravel/workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "src/Laravel/workbench/database/seeders/"
}
},
"config": {
Expand Down Expand Up @@ -181,7 +193,9 @@
"api-platform/serializer",
"api-platform/state",
"api-platform/symfony",
"api-platform/validator"
"api-platform/validator",
"api-platform/laravel",
"api-platform/json-api"
]
},
"repositories": [
Expand All @@ -202,6 +216,8 @@
{"type": "path", "url": "./src/Serializer"},
{"type": "path", "url": "./src/State"},
{"type": "path", "url": "./src/Symfony"},
{"type": "path", "url": "./src/Validator"}
{"type": "path", "url": "./src/Validator"},
{"type": "path", "url": "./src/Laravel"},
{"type": "path", "url": "./src/JsonApi"}
]
}
5 changes: 3 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ parameters:
- src/Symfony/Bundle/Test/Constraint/ArraySubset.php
- tests/Fixtures/app/AppKernel.php
excludePaths:
# uses larastan
- src/Laravel
- src/Symfony/Bundle/Command/OpenApiCommand.php
# Symfony config
- tests/Fixtures/app/config/config_swagger.php
Expand Down Expand Up @@ -86,7 +88,7 @@ parameters:
# Expected, due to backward compatibility
-
message: "#Call to function method_exists\\(\\) with ApiPlatform\\\\JsonApi\\\\Serializer\\\\ItemNormalizer and 'setCircularReferenc…' will always evaluate to false\\.#"
path: tests/JsonApi/Serializer/ItemNormalizerTest.php
path: src/JsonApi/Tests/Serializer/ItemNormalizerTest.php
- '#Method GraphQL\\Type\\Definition\\WrappingType::getWrappedType\(\) invoked with 1 parameter, 0 required\.#'
- '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#'
# See https://github.com/phpstan/phpstan-symfony/issues/27
Expand All @@ -99,5 +101,4 @@ parameters:
# Backward compatibility
- '#Call to method hasCacheableSupportsMethod\(\) on an unknown class Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface\.#'
- '#Class Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface not found\.#'
- '#Access to undefined constant Symfony\\Component\\HttpKernel\\HttpKernelInterface::MASTER_REQUEST\.#'
- '#Attribute class PHPUnit\\Framework\\Attributes\\DataProvider does not exist.#'
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</include>
<exclude>
<directory>src/Symfony/Maker/Resources/skeleton</directory>
<directory>src/Laravel</directory>
<directory>features</directory>
<directory>tests</directory>
<directory>vendor</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Action/NotExposedAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ApiPlatform\Action;

use ApiPlatform\Exception\NotExposedHttpException;
use ApiPlatform\Metadata\Exception\NotExposedHttpException;
use Symfony\Component\HttpFoundation\Request;

/**
Expand Down
65 changes: 0 additions & 65 deletions src/Api/CompositeIdentifierParser.php

This file was deleted.

Loading

0 comments on commit 0d5f356

Please sign in to comment.