Skip to content

OSW3/symfony-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 

Repository files navigation

API

Add simple API to Symfony projects

Install

Instal the bundle

comoser require osw3/symfony-api

Prepare for update

In your composer.json file, change the line of the dependency to prepare futures updates of the bundle.

"osw3/symfony-api": "*",

Enable the bundle

Add the bundle in the config/bundle.php file.

return [
    OSW3\Api\ApiBundle::class => ['all' => true],
];

Usage

Enable the router

Add the bundle route to the config/routes.yaml file.

_api:
    resource: '@ApiBundle/Resources/config/routes.yaml'

Configure the bundle

api:

    my_api_v1:
        version: 1
        collections:
            all_books:
                class: App\Entity\Book
                privileges:
                    public:
                        granted: null #'PUBLIC_ACCESS'
                        methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']

About

Add simple API to Symfony projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages