michaeldrennen / jsonapi
一个不依赖于框架的PHP库,实现了json:api规范的一些功能。
v2.0.1
2024-08-02 23:50 UTC
Requires
- php: ^7|^8
- illuminate/support: ^6|^7|^8|^9|^10|^11
Requires (Dev)
- phpunit/phpunit: ^8|^9|^10|^11
README
这是一个PHP库,适用于想要构建API并返回结构化数据给请求客户端的开发者。
// 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();