Download the PHP package webstack/api-platform-extensions-bundle without Composer
On this page you can find all versions of the php package webstack/api-platform-extensions-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webstack/api-platform-extensions-bundle
More information about webstack/api-platform-extensions-bundle
Files in webstack/api-platform-extensions-bundle
Package api-platform-extensions-bundle
Short Description Bundle to add uuid filter, or search and global search support for Doctrine ORM to API Platform
License MIT
Homepage https://webstack.nl
Informations about the package api-platform-extensions-bundle
API Platform extensions bundle
TODO: what is API Platform and how do we extend it?
Installing
composer require webstack/api-platform-extensions-bundle:[version]
Configuring
After installing the plugin you will need to add some config files to you're project:
-
config/packages/webstack_api_platform_extensions.yaml
- config/routes/api_platform.yaml
Filters
These filters are added by this bundle:
GlobalSearchFilter (api_platform.doctrine.orm.global_search_filter
)
Searches (recursively?) through the specified columns (or all of them, scary stuff) of an entity on whose endpoint it's activated.
Configure the filter as a service (config/services/api_platform/search/[$domain/]$entity.yaml
):
And apply it to the appropriate resource:
Now when a user calls the API with ?_global_search=foo
, the query will become something like this:
AliasSearchFilter (api_platform.doctrine.orm.alias_search_filter
)
Works as the regular search filter, but lets you rename or alias (nested) properties in the URL. Pass the properties and aliases as separate DI arguments:
And apply it to the appropriate resource:
Now to hit this filter, the URL using the default SearchFilter would be:
/some?deeply.nested.property=foo
This alias search filter adds a new query string parameter that it'll map to the configured alias:
/some?myProp=foo
OrSearchFilter (api_platform.doctrine.orm.or_search_filter
)
TODO
UuidFilter (api_platform.doctrine.orm.uuid_filter
)
For looking up nested entities by their UUID, because API Platform doesn't support that (see https://github.com/api-platform/core/pull/3774, was reverted because it broke date search).
Service configuration:
API Platform entity configuration:
Now the API caller can filter using GET .../transport_positions?vehicle.id=$uuid
.
Routes
The bundle introduces the following route(s):
/me
Get info about the caller. Includes a SwaggerDecorator to generate OpenAPI documentation about this endpoint.
All versions of api-platform-extensions-bundle with dependencies
api-platform/core Version ^3.0
doctrine/doctrine-bundle Version ^2.6
doctrine/orm Version ^2.11
ramsey/uuid-doctrine Version ^1.8
symfony/security-bundle Version ^6.2
symfony/serializer Version ^6.2