DEPRECATED use https://github.com/chubbyphp/petstore
A slim 3 skeleton to build web apis.
- php: ~7.0
- chubbyphp/chubbyphp-api-http: ~1.0@beta>=1.0-beta15
- chubbyphp/chubbyphp-deserialization: ^1.1.1
- chubbyphp/chubbyphp-deserialization-model: ~1.1
- chubbyphp/chubbyphp-lazy: ~1.1
- chubbyphp/chubbyphp-model: ^3.0.1
- chubbyphp/chubbyphp-model-doctrine-dbal: ^1.0.2
- chubbyphp/chubbyphp-serialization: ~1.1
- chubbyphp/chubbyphp-translation: ^1.1.2
- chubbyphp/chubbyphp-validation: ~2.1
- chubbyphp/chubbyphp-validation-model: ^1.0.2
- monolog/monolog: ~1.5
- ramsey/uuid: 2.0
- silex/providers: ^2.0.3
- slim/slim: ~3.0
- symfony/console: ~2.7|~3.0
- symfony/yaml: ~2.7|~3.0
composer create-project chubbyphp/chubbyphp-api-slim-skeleton myproject dev-master --prefer-dist
bin/console chubbyphp:model:dbal:database:create
bin/console chubbyphp:model:dbal:database:schema:update --dump --force
GET http://chubbyphp-api-slim-skeleton.dev/api
{
"_links": {
"self": {
"href": "/api",
"method": "GET"
},
"courses": {
"href": "/api/courses",
"method": "GET"
}
},
"_type": "index"
}
GET http://chubbyphp-api-slim-skeleton.dev/api
<?xml version="1.0" encoding="UTF-8"?>
<meta-type value="index">
<meta-links>
<self>
<href type="string">/api</href>
<method type="string">GET</method>
</self>
<courses>
<href type="string">/api/courses</href>
<method type="string">GET</method>
</courses>
</meta-links>
</meta-type>
GET http://chubbyphp-api-slim-skeleton.dev/api
_links:
self:
href: /api
method: GET
courses:
href: /api/courses
method: GET
_type: index
GET http://chubbyphp-api-slim-skeleton.dev/api/courses?page=1&perPage=1
{
"page": 1,
"perPage": 1,
"sort": null,
"order": "asc",
"_embedded": {
"count": 1,
"pages": 1,
"courses": [
{
"id": "d480082e-ef4f-43e6-96e8-fd2b9fa613ff",
"name": "PHP Course",
"level": 3,
"progress": 0.45,
"active": true,
"documents": [
{
"id": "28031482-6168-47f1-a78b-ea57f38d0ef0",
"name": "Choose the right abstraction",
"url": "http://test.com/choose-the-right-abstractions.pdf",
"_type": "document"
}
],
"_links": {
"read": {
"href": "/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff",
"method": "GET"
},
"update": {
"href": "/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff",
"method": "PATCH"
},
"delete": {
"href": "/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff",
"method": "DELETE"
}
},
"_type": "course"
}
]
},
"_links": {
"self": {
"href": "/api/courses?page=1&perPage=1&order=asc",
"method": "GET"
},
"create": {
"href": "/api/courses",
"method": "POST"
}
},
"_type": "course-search"
}
GET http://chubbyphp-api-slim-skeleton.dev/api/courses?page=1&perPage=1
<?xml version="1.0" encoding="UTF-8"?>
<meta-type value="course-search">
<page type="integer">1</page>
<perPage type="integer">1</perPage>
<sort></sort>
<order type="string">asc</order>
<meta-embedded>
<count type="integer">1</count>
<pages type="integer">1</pages>
<courses>
<meta-type value="course" key="0">
<id type="string">d480082e-ef4f-43e6-96e8-fd2b9fa613ff</id>
<name type="string">PHP Course</name>
<level type="integer">3</level>
<progress type="float">0.45</progress>
<active type="boolean">true</active>
<documents>
<meta-type value="document" key="0">
<id type="string">28031482-6168-47f1-a78b-ea57f38d0ef0</id>
<name type="string">Choose the right abstraction</name>
<url type="string">http://test.com/choose-the-right-abstractions.pdf</url>
</meta-type>
</documents>
<meta-links>
<read>
<href type="string">/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff</href>
<method type="string">GET</method>
</read>
<update>
<href type="string">/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff</href>
<method type="string">PATCH</method>
</update>
<delete>
<href type="string">/api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff</href>
<method type="string">DELETE</method>
</delete>
</meta-links>
</meta-type>
</courses>
</meta-embedded>
<meta-links>
<self>
<href type="string">
<![CDATA[/api/courses?page=1&perPage=1&order=asc]]>
</href>
<method type="string">GET</method>
</self>
<create>
<href type="string">/api/courses</href>
<method type="string">POST</method>
</create>
</meta-links>
</meta-type>
GET http://chubbyphp-api-slim-skeleton.dev/api/courses?page=1&perPage=1
page: 1
perPage: 1
sort: null
order: asc
_embedded:
count: 1
pages: 1
courses:
-
id: d480082e-ef4f-43e6-96e8-fd2b9fa613ff
name: 'PHP Course'
level: 3
progress: 0.45
active: true
documents:
-
id: 28031482-6168-47f1-a78b-ea57f38d0ef0
name: 'Choose the right abstraction'
url: 'http://test.com/choose-the-right-abstractions.pdf'
_type: document
_links:
read:
href: /api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff
method: GET
update:
href: /api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff
method: PATCH
delete:
href: /api/courses/d480082e-ef4f-43e6-96e8-fd2b9fa613ff
method: DELETE
_type: course
_links:
self:
href: '/api/courses?page=1&perPage=1&order=asc'
method: GET
create:
href: /api/courses
method: POST
_type: course-search