PHPackages                             cura/api-platform-extras - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cura/api-platform-extras

AbandonedArchivedLibrary[API Development](/categories/api)

cura/api-platform-extras
========================

Wrapper classes for API Platform

1.1.2(2y ago)04.8k1MITPHP

Since May 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cura4you/api-platform-extras)[ Packagist](https://packagist.org/packages/cura/api-platform-extras)[ RSS](/packages/cura-api-platform-extras/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (5)Used By (0)

API Platform Extras
===================

[](#api-platform-extras)

Based on the popular library [API platform](https://api-platform.com/) this library adds an abstraction layer on top of the Processor/Provider interfaces that can be extended for custom logic.

This library can be used if you find yourself needing to implement custom processors/providers for API platform and don't want to re-implement the boilerplate code over and over again. Additionally the abstract classes have phpstan templating support.

While extending the abstract processor you are not required to extend all abstract methods but instead only those that you actually want to be supported. If your resource should only be supporting `POST` and `PATCH` then you would only have to extend the `handlePostOperation` and `handleDeleteOperation`. This also enables you to create a single processor per HTTP method.

When extending the abstract provider you are free to extend either the `provideCollection` and `provideItem` function. By default those return an empty array and null, respectively. If your application has custom logic to determine when a collection is to be returned you can extend the `canProvideCollection` function. If it returns true the abstract provider will call the `provideCollection` function, otherwise it will call the `provideItem` function.

Example usage
-------------

[](#example-usage)

Example of a custom processor (supporting all HTTP methods):

```
