User Tools

Site Tools


symfony_apiplatform

This is an old revision of the document!


Symfony Api Platform

quick

composer create-project symfony/skeleton bookshop-api
cd bookshop-api
composer require symfony/orm-pack
composer require --dev symfony/maker-bundle
composer req api

fill .env with database infos and then
bin/console doctrine:database:create
bin/console make:entity
#bin/console doctrine:schema:create
bin/console make:migration
bin/console doctrine:migrations:migrate
run test server
php -S 192.168.0.124:8000 -t public
frontend available at http://192.168.0.124:8000/api

notes

adding some infos

add title, description and version. in config/packages/api_platform.yaml

api_platform:
    title: "toto"
    description: "ben voila"
    version: "1.0"
    mapping:
        paths: ['%kernel.project_dir%/src/Entity']
    patch_formats:
        json: ['application/merge-patch+json']
    swagger:
        versions: [3]

disable operations

 * @ApiResource(
 *     collectionOperations={"get"},
 *     itemOperations={"get", "put", "delete"}
 * )

symfony_apiplatform.1607607795.txt.gz · Last modified: (external edit)