Download the PHP package ops-talent/apibundle without Composer
On this page you can find all versions of the php package ops-talent/apibundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ops-talent/apibundle
More information about ops-talent/apibundle
Files in ops-talent/apibundle
Informations about the package apibundle
Api-bundle
This bundle provides various tools to rapidly develop RESTful API's & applications with Symfony 3.x.
Features:
- Endpoint Generator (all you need is Entity)
- JSON response
- Exception hendler
- OAuth2 - friendsofsymfony/oauth-server-bundle
Instalation
composer require opstalent/apibundle "dev-master
Bundle Depend on
"friendsofsymfony/oauth-server-bundle": "^1.5", "friendsofsymfony/user-bundle": "~2.0@dev"
Manual Configuration
1. Create entity
2. Create Repository and register as service
Repository should extend Opstalent\ApiBundle\Repository\BaseRepository
We need register repository as service service.yml `
3. Create Forms
Generator generate 3 forms AddType
, EditType
and FilterType
We recommend to separate add form and filter form but separate.
AddType
``
EditType
``
FilterType
``
4. Create routing
We like to define routing for endpoint in separate file.
pages.yml
This file is used both by api-bundle and security-bundle. Let's take a closer look to this line all endpoints use controller
OpstalentApiBundle:Actionand depend on action it will be
list, get, post, put, delete. parameter
methods: [GET]` is normal route parameter.
unde option we have some custom params.
form
Define what form type should be used for example AppBundle\Form\Page\FilterType
serializerGroups(optional)
Define what serializer group should be used on different roles. Default is list
for List action and get
for all other action. If we want custom serializedGroups on this action we can define own table for example
All option is used when action cannot match any other option and its mandatory if we define parameter
serializerGroups`. Option owner is used to check is logged user is owner of this data and could be defined for all actions except list.
Third value is role, and if user has this role (or more) he get all serializer Groups he match.
repository
is used to define what repository should be used for this action for example '@repository.page'
security
Security define how we want to secure our endpoint. For all actions default secure
option is true
and roles
is ROLE_SUPER_ADMIN
.
There is third option where we define events for this endpoint.
Full security example
`
Generator
Generator is used to generate all files described above for us. All we need is Entity. To run generator we need type
php bin/console app:generatecrude
additional options
- entityPath - to generate crud for specific entity
- overwrite - to overwrite previous configuration
- actions to define what actions shoudl be generated for endpoints. Available actions
[LIST,GET,POST,PUT,DELETE]
Recommended Security Bundle
License
This bundle is under the MIT license. See the complete license in the bundle:
License
All versions of apibundle with dependencies
friendsofsymfony/oauth-server-bundle Version ^1.5
friendsofsymfony/user-bundle Version ~2.0@dev
symfony/form Version ^3.2
symfony/serializer Version ^3.2
symfony/security Version ^3.2
symfony/event-dispatcher Version ^3.2
symfony/property-access Version ^3.2
symfony/http-foundation Version ^3.2
symfony/http-kernel Version ^3.2
symfony/routing Version ^3.2
doctrine/annotations Version ^1.4
symfony/dependency-injection Version ^3.2
doctrine/common Version ^2.7
symfony/property-info Version ^3.2