osw3/symfony-api

OSW3 API Bundle for Symfony

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0.3 2023-12-02 01:58 UTC

README

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']