- Notifications
You must be signed in to change notification settings - Fork7
📦 Base classes and helper services to build API application via Symfony.
License
stfalcon-studio/ApiBundle
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
📦 Base classes and helper services to build API application via Symfony.
composer req stfalcon-studio/api-bundle
Add next dependencies if you want to use JWT auth
composer req gesdinet/jwt-refresh-token-bundlecomposer req lexik/jwt-authentication-bundle
By default, Symfony Flex adds this bundle to theconfig/bundles.php
file.In case when you ignoredcontrib-recipe
during bundle installation it would not be added. In this case add the bundle manually.
# config/bundles.phpreturn [// Other bundles...StfalconStudio\ApiBundle\StfalconApiBundle::class => ['all' =>true],// Other bundles...];
doctrine:orm:mappings:StfalconApiBundle:~
The default directory is./src/Json/Schema/
. Or you can change it via bundle configuration.
stfalcon_api:api_host:'%env(APP_API_HOST)%'json_schema_dir:'%kernel.project_dir%/src/Json/Schema/'jwt:enabled:true# set false to disable JWT authredis_client_jwt_black_list:"@snc_redis.jwt_black_list"
For simple dictionary enums, you can use theDictionaryEnumInteface
interface on Enums.It will register for serialization like a dictionary, so the result will be like:
{"id":1,"value":"Enum name"}
So, now the dictionary action will look like:
#[Route(path:'/foo/bar', name:'foo_bar', methods: [Request::METHOD_GET])]publicfunction__invoke():JsonResponse{// ...returnnewJsonResponse(data:$this->serializer->serialize(FooBar::cases()), json:true);}
In some cases, you may need to serialise dictionary value not as dictionary, for this just add in context parameterdefault_normalization
with any value.
$this->serializer->serialize($fooBar,'json', ['default_normalization' =>true]);
Read theCONTRIBUTING file.
About
📦 Base classes and helper services to build API application via Symfony.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.