uni-method/symfony-bundle

There is no license information available for the latest version (0.1.7) of this package.

Jsonapi symfony implementation bundle

Installs: 53

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.1.7 2022-11-27 22:53 UTC

This package is auto-updated.

Last update: 2024-04-28 01:50:26 UTC


README

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require uni-method/symfony-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require uni-method/symfony-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    UniMethod\Bundle\UniMethodBundle::class => ['all' => true],
];

Step 3: Bundle options

Create if not exist config/packages/uni_method.yaml

uni_method:
  default_path: '%kernel.project_dir%/config/jsonapi' # path to entities config
  prefix: 'v' # prefix for version forexample /v1/user/
  available: # all available versions
    - 1 # version (subfolder in default_path)

Step 4: Create first version (v1)

# config/jsonapi/1/config.yml
entities:
  user:
    class: 'App\Entity\User'
    description: 'Just a user'
    attributes:
      id:
        getter: 'getId()'
        type: integer
      email:
        getter: 'getEmail()'
        type: string
paths:
  -
    item: user
    method: list

Step 5: Enable Bundle routing

# config/routes.yaml

app_extra:
  resource: .
  type: extra