michaeldrennen / jsonapi
A framework agnostic PHP library that implements some of the json:api specification.
Installs: 3 732
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7|^8
- illuminate/support: ^6|^7|^8|^9|^10|^11
Requires (Dev)
- phpunit/phpunit: ^8|^9|^10|^11
README
This is a PHP library for those wanting to build an API and return structured data to the requesting client.
// This $user is the object we want to return to the client requesting the User data. $user = new User( 74, "Mike", TRUE ); // Create the response object, set the $user as the data you want to return, and // specify the Transformer you want to use to munge the User data. $array = \MichaelDrennen\JSONAPI\Response::create() ->setData( $user ) ->transformWith( new UserTransformer() ) ->toArray();