The repository you are currently viewing is a proof-of-concept.
My aim is to create an API who's validation, hydration, and transformation is directed by the Entity definition.
The API is based off of refinery29/piston.
The endpoints are defined as "actions".
- Clone the repo:
git clone git@github.com:rcatlin/content-api-test
- cd into the repo:
cd content-api-test
- Install PHP dependencies:
make composer
- Instantiate the DB and run migrations:
make db
- Start a local instance:
make start-dev
- Hit
locahost:8000/api/ping
in your browser and you should see a JSON response with{"result": ["pong"]}
- Create a new Entity called
Qux
in theEntity
directory, with columns/fields. - Run
./bin/console migrations:diff
to generate a new migration that will create the table for your new Entity - Migrate
make migrate
to create that table. - Run the dev server
make start-dev
- Hit
POST localhost:8000/qux
with a JSON request body of only the non-nullable fields with the correct type. You should get a JSON response with anid
- Hit
GET localhost:8000/qux/{id}
where{id}
is theid
returned from the succesfullPOST
response. The response should be aOK 200
response. - Hit
DELETE localhost:8000/qux/{id}
, the response should be aACCEPTED 202
- Hit
GET localhost:8000/qux/{id}
, the response should be aNOT_FOUND 404