silverbackis / api-component-bundle
Creates a flexible API for a website's structure, reusable components and common functionality.
Package info
github.com/components-web-app/api-components-bundle
Type:symfony-bundle
pkg:composer/silverbackis/api-component-bundle
Requires
- php: >=8.5
- ext-exif: *
- ext-fileinfo: *
- ext-json: *
- ext-pdo: *
- ext-simplexml: *
- api-platform/core: ^4.4.5 || ^5.0.4
- cocur/slugify: ^4.7
- doctrine/dbal: ^4.4
- doctrine/doctrine-bundle: ^3.3
- doctrine/doctrine-migrations-bundle: ^3.7 || ^4.0
- doctrine/orm: ^3.7
- imagine/imagine: ^1.5
- lcobucci/clock: ^3.0
- lexik/jwt-authentication-bundle: ^3.2
- liip/imagine-bundle: ^2.17
- nelmio/cors-bundle: ^2.6
- ocramius/package-versions: ^2.12
- phpdocumentor/reflection-docblock: ^5.6 || ^6.0
- ramsey/collection: ^1.3 || ^2.1
- ramsey/uuid: ^4.9
- ramsey/uuid-doctrine: ^2.1
- symfony/asset: ^7.4 || ^8.1
- symfony/console: ^7.4 || ^8.1
- symfony/doctrine-bridge: ^7.4 || ^8.1
- symfony/event-dispatcher: ^7.4 || ^8.1
- symfony/expression-language: ^7.4.21 || ^8.1.9
- symfony/form: ^7.4 || ^8.1
- symfony/framework-bundle: ^7.4 || ^8.1
- symfony/mailer: ^7.4 || ^8.1
- symfony/mercure: ^0.8 || ^0.9
- symfony/mercure-bundle: ^0.5 || ^0.6
- symfony/property-access: ^7.4 || ^8.1
- symfony/property-info: ^7.4 || ^8.1
- symfony/security-bundle: ^7.4 || ^8.1
- symfony/serializer: ^7.4 || ^8.1
- symfony/twig-bundle: ^7.4 || ^8.1
- symfony/type-info: ^7.4 || ^8.1
- symfony/validator: ^7.4 || ^8.1
- symfony/var-exporter: ^7.4 || ^8.1
- twig/cssinliner-extra: ^3.26
- twig/extra-bundle: ^3.29
- twig/inky-extra: ^3.26
- twig/twig: ^3.29
Requires (Dev)
- brianium/paratest: ^7.26
- dama/doctrine-test-bundle: ^8.6
- doctrine/doctrine-fixtures-bundle: ^4.3
- friendsofphp/php-cs-fixer: ^3.95
- justinrainbow/json-schema: ^6.4
- league/flysystem: ^3.36
- league/flysystem-memory: ^3.31
- monolog/monolog: ^3.12
- phpspec/prophecy: ^1.26
- phpstan/extension-installer: ^1.4
- phpstan/phpdoc-parser: ^2.3
- phpstan/phpstan: ^2.2
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- roave/security-advisories: dev-master
- symfony/browser-kit: ^7.4 || ^8.1
- symfony/dotenv: ^7.4 || ^8.1
- symfony/http-client: ^7.4 || ^8.1
- symfony/maker-bundle: ^1.68
- symfony/messenger: ^7.4 || ^8.1
- symfony/monolog-bundle: ^3.11 || ^4.1
- symfony/phpunit-bridge: ^7.4 || ^8.1
- symfony/stopwatch: ^7.4 || ^8.1
- symfony/translation: ^7.4 || ^8.1
- symfony/web-profiler-bundle: ^7.4 || ^8.1
- symfony/yaml: ^7.4 || ^8.1
Suggests
- ext-pdo_mysql: To use MySQL 8.0 or above, or MariaDB 10.10 or above
- ext-pdo_pgsql: To use PostgreSQL 12 or above
- ext-pdo_sqlite: To use SQLite 3.8.3 or above
Provides
None
Conflicts
- doctrine/collections: <1.7
- symfony/serializer: <=6.1.2
- symfony/var-exporter: <6.1
- symfony/web-link: <=6.0
- willdurand/negotiation: ^2
Replaces
None
- dev-main / 2.x-dev
- 2.0.0-alpha.32
- 2.0.0-alpha.31
- 2.0.0-alpha.30
- 2.0.0-alpha.29
- 2.0.0-alpha.28
- 2.0.0-alpha.27
- 2.0.0-alpha.26
- 2.0.0-alpha.25
- 2.0.0-alpha.24
- 2.0.0-alpha.23
- 2.0.0-alpha.22
- 2.0.0-alpha.21
- 2.0.0-alpha.20
- 2.0.0-alpha.19
- 2.0.0-alpha.18
- 2.0.0-alpha.17
- 2.0.0-alpha.16
- 2.0.0-alpha.15
- 2.0.0-alpha.14
- 2.0.0-alpha.13
- 2.0.0-alpha.12
- 2.0.0-alpha.11
- 2.0.0-alpha.10
- 2.0.0-alpha.9
- 2.0.0-alpha.8
- 2.0.0-alpha.7
- 2.0.0-alpha.6
- 2.0.0-alpha.5
- 2.0.0-alpha.4
- 2.0.0-alpha.3
- 2.0.0-alpha.2
- 2.0.0-alpha.1
- v1.x-dev
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.1
- dev-feat/531-usage-admin-only
- dev-fix/537-route-security-anchored
- dev-feat/531-component-usage-locations
- dev-fix/generate-fixtures-unwritable-output
- dev-test/516-uploads-fixtures
- dev-test/516-security-routes
- dev-feat/526-component-move
- dev-test/516-pages-manifest
- dev-test/516-users-forms
- dev-test/516-orphans-purge-components
- dev-test/515-behat-port-decisions
- dev-fix/520-draft-references-groups
- dev-fix/infection-main
- dev-infectionfullcheck
- dev-fix/520-draft-references
- dev-chore/paratest
- dev-test/520-clone-and-usage
- dev-chore/json-schema-6
- dev-test/504-phpunit
- dev-test/504-phase3
- dev-test/504-port-users
- dev-test/504-port-orphans
- dev-test/504-port-pages
- dev-test/504-port-uploads
- dev-test/504-port-security
- dev-test/504-port-components
- dev-test/504-port-fixtures
- dev-test/504-port-routes
- dev-test/504-helpers
- dev-test/504-phpunit-pilot
- dev-fix/502-component-cycles
- dev-fix/sub-request-stopwatch
- dev-fix/498-mercure-cookie-lifetime
- dev-fix/494-mercure-public-payloads
- dev-fix/mercure-clear-cookie
- dev-fix/492-unpublished-static-component
- dev-fix/489-shared-asset-hash
- dev-fix/488-warm-brotli
- dev-fix/481-shared-asset-store-prune
- dev-feature/484-scoped-purge-and-warm
- dev-fix/482-483-fixture-guards
- dev-feature/475-component-group-ordering
- dev-feature/477-delete-stored-files
- dev-fix/457-uploaded-file-validation
- dev-feature/455-uploaded-image-constraint
- dev-release/2.0.0-alpha.22
- dev-fix/452-readable-generated-fixtures
This package is auto-updated.
Last update: 2026-10-19 15:49:30 UTC
README
PHPUnit Testing Only
Creates a flexible API for a website's structure, reusable components and common functionality.
Read the documentation
Requirements
- PHP 8.5
- Symfony
^7.4 || ^8.1 - API Platform
^4.4 || ^5.0 - Doctrine ORM 3
Testing
Run everything from the repository root after composer install.
Setting up the test database
The functional tests use an in-memory SQLite database per process. To create the test app's file database by hand, for example to inspect the schema:
php tests/Functional/app/bin/console -e test doctrine:database:create php tests/Functional/app/bin/console -e test doctrine:schema:create php tests/Functional/app/bin/console -e test doctrine:schema:validate
PHPUnit
vendor/bin/paratest # both suites, one process per CPU, as CI runs them vendor/bin/paratest --testsuite functional # paratest takes PHPUnit's options php -d memory_limit=-1 vendor/bin/phpunit # both suites in one process php vendor/bin/phpunit --testsuite unit # unit tests php vendor/bin/phpunit --testsuite functional # functional tests on the test app php vendor/bin/phpunit tests/Functional/HttpCache # one area API_PLATFORM_USE_SYMFONY_LISTENERS=1 php vendor/bin/phpunit --testsuite functional # with use_symfony_listeners
Unit tests (outside tests/Functional, mirroring src/) cover pure logic and service wiring. They never boot a kernel: wiring is asserted by loading the bundle's config into a bare ContainerBuilder. Tests that need a database use an in-memory SQLite EntityManager.
Functional tests (tests/Functional/<Area>/) cover API behaviour. They extend FunctionalTestCase, which boots the test app in tests/Functional/app and rolls back the database after each test, and share the helper traits in tests/Functional/Trait. The container is not rebuilt automatically: after changing a service, config file or route, run php tests/Functional/app/bin/console cache:clear -e test, and delete tests/Functional/app/var/paratest-*, where each paratest process keeps its own cache.
Every new behaviour or bug fix starts with a test that fails first.
Coverage
php -d pcov.enabled=1 vendor/bin/phpunit --configuration=phpunit.coverage.xml.dist --coverage-clover=build/logs/phpunit/clover.xml
Warm the test app's cache first, as CI does. CI uploads this report to Codecov.
Mutation testing (Infection)
Infection runs in CI on the PHPUnit coverage job, with a covered-code MSI gate of 80%. It is not a Composer dependency. Download the signed phar at the version pinned in .github/workflows/ci.yml (INFECTION_VERSION) and run it against PHPUnit's coverage:
php -d pcov.enabled=1 vendor/bin/phpunit --configuration=phpunit.coverage.xml.dist \ --coverage-xml=build/logs/phpunit/coverage-xml --log-junit=build/logs/phpunit/junit.xml php infection.phar --coverage=build/logs/phpunit --min-covered-msi=80
In CI, a pull request runs Infection only on the lines it adds or changes in src/ (--git-diff-lines), with the same 80% gate applied to those lines. A PR with no PHP changes passes. Every push to main runs the full mutation set, and only that run updates the Stryker badge.
Infection scores the coverage of both suites. Give new classes unit tests as well.
Static analysis and coding standards
vendor/bin/phpstan analyse --memory-limit=1G # level 5, against phpstan-baseline.neon vendor/bin/php-cs-fixer fix # run before every commit; CI fails on violations
A PHPStan fix that removes a baselined finding must also remove its entry: regenerate the baseline with vendor/bin/phpstan analyse --memory-limit=1G --generate-baseline phpstan-baseline.neon.
What CI runs
Every pull request and every push to main runs these checks:
- PHPUnit, both suites, on Symfony 7.4, 8.1, the next Symfony version and lowest dependencies. The Symfony 7.4 job also collects coverage and runs Infection.
- The functional suite on each Symfony and API Platform combination, and once with
use_symfony_listeners. - PHPStan, php-cs-fixer and GitGuardian.
- Codecov patch and project coverage.
Sponsors
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Vincent 💻 🤔 👀 |
Pierre Rebeilleau ⚠️ |
Robin Chalas 💻 |
Antoine Bluchet 🐛 |
Maxime Helias 📖 |
This project follows the all-contributors specification. Contributions of any kind are welcome!