{"id":15489506,"url":"https://github.com/phpguild/api-bundle","last_synced_at":"2026-01-07T20:04:18.534Z","repository":{"id":44669983,"uuid":"340467879","full_name":"phpguild/api-bundle","owner":"phpguild","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-01T19:39:02.000Z","size":508,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-02T16:37:08.068Z","etag":null,"topics":["filter-multisearch","geodistance-filter","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpguild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-19T19:21:45.000Z","updated_at":"2021-09-16T05:14:48.000Z","dependencies_parsed_at":"2023-02-17T10:05:14.221Z","dependency_job_id":null,"html_url":"https://github.com/phpguild/api-bundle","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpguild%2Fapi-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpguild%2Fapi-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpguild%2Fapi-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpguild%2Fapi-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpguild","download_url":"https://codeload.github.com/phpguild/api-bundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246059337,"owners_count":20717085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filter-multisearch","geodistance-filter","symfony","symfony-bundle"],"created_at":"2024-10-02T07:06:10.084Z","updated_at":"2026-01-07T20:04:18.460Z","avatar_url":"https://github.com/phpguild.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symfony API Bundle\n\n## Features\n\n### Authentication\n- Endpoint `[POST] /oauth/authenticate` for authenticate user with login/password and return JWT Bearer token\n- Endpoint `[POST] /oauth/refresh_token` for authenticate user with refresh token and return JWT Bearer token\n- Endpoint `[GET,PUT] /users/me` for authenticated user information\n\n### Filters\n- Filter Multisearch for search in multi fields `_search=Search%20term`\n- Filter GeoDistance for search around user lat/lng `_distance[lat]=40.123\u0026_distance[lng]=1.123\u0026_distance[near]=30`\n\n## Installation\n\nInstall with composer\n\n    composer req phpguild/api-bundle\n\n## Configure API Platform\n\nEdit `config/packages/api_platform.yaml`\n\n    api_platform:\n        version: '1.0.0'\n        mapping:\n            paths: [ '%kernel.project_dir%/src/Entity' ]\n        patch_formats:\n            json: [ 'application/merge-patch+json' ]\n        formats:\n            jsonld:\n                mime_types: [ 'application/ld+json' ]\n            json:\n                mime_types: [ 'application/json' ]\n            html:\n                mime_types: [ 'text/html' ]\n        error_formats:\n            jsonld:\n                mime_types: [ 'application/ld+json' ]\n            json:\n                mime_types: [ 'application/json' ]\n        swagger:\n            versions: [ 3 ]\n            api_keys:\n                apiKey:\n                    name: Authorization\n                    type: header\n        defaults:\n            pagination_enabled: true\n            pagination_items_per_page: 10\n            pagination_maximum_items_per_page: 30\n            pagination_client_partial: true\n            pagination_client_items_per_page: true\n        collection:\n            exists_parameter_name: _exists\n            order_parameter_name: _order\n            pagination:\n                page_parameter_name: _page\n                items_per_page_parameter_name: _itemsPerPage\n                partial_parameter_name: _partial\n\n## Configure User authentication with JWT\n\nEdit `config/packages/security.yaml`\n\n    security:\n\n        encoders:\n            App\\Entity\\User:\n                algorithm: auto\n\n        providers:\n            authentication_user_provider:\n                entity:\n                    class: App\\Entity\\User\n                    property: username\n\n            token_user_provider:\n                entity:\n                    class: App\\Entity\\User\n                    property: id\n\n        firewalls:\n            dev:\n                pattern: ^/(_(profiler|wdt)|css|images|js)/\n                security: false\n\n            oauth_refresh_token:\n                pattern:  ^/oauth/refresh_token\n                stateless: true\n                anonymous: true\n    \n            oauth_authenticate:\n                pattern:  ^/oauth/authenticate\n                stateless: true\n                anonymous: true\n                user_checker: PhpGuild\\UserBundle\\Security\\UserChecker\n                json_login:\n                    provider: authentication_user_provider\n                    check_path: api_users_authentication\n                    success_handler: lexik_jwt_authentication.handler.authentication_success\n                    failure_handler: lexik_jwt_authentication.handler.authentication_failure\n    \n            api:\n                pattern:  ^/\n                stateless: true\n                anonymous: true\n                provider: token_user_provider\n                guard:\n                    authenticators:\n                        - lexik_jwt_authentication.jwt_token_authenticator\n\n            main:\n                anonymous: true\n                lazy: true\n\n    access_control:\n        - { path: ^/oauth/authenticate, methods: [ POST ], roles: IS_AUTHENTICATED_ANONYMOUSLY }\n        - { path: ^/oauth/refresh_token, methods: [ POST ], roles: IS_AUTHENTICATED_ANONYMOUSLY }\n        - { path: ^/api/docs, roles: IS_AUTHENTICATED_ANONYMOUSLY }\n        - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }\n\n\nEdit `config/packages/lexik_jwt_authentication.yaml`\n\n    lexik_jwt_authentication:\n        secret_key: '%env(resolve:JWT_SECRET_KEY)%'\n        public_key: '%env(resolve:JWT_PUBLIC_KEY)%'\n        pass_phrase: '%env(JWT_PASSPHRASE)%'\n        token_ttl: 3600\n        user_identity_field: id\n        token_extractors:\n            authorization_header:\n                enabled: true\n                prefix:  Bearer\n                name:    Authorization\n\nEdit `config/routes.yaml`\n\n    phpguild_api_oauth:\n        resource: '@PhpGuildApiBundle/Resources/config/routes/oauth.yaml'\n        prefix: /oauth\n\n## Configure refresh Token\n\n    gesdinet_jwt_refresh_token:\n        firewall: api\n        ttl: 2592000\n        ttl_update: true\n        user_identity_field: id\n        user_provider: security.user.provider.concrete.token_user_provider\n\n## Multisearch filter\n\n### Usage\n\n    use PhpGuild\\ApiBundle\\Doctrine\\Orm\\Filter\\MultisearchFilter;\n    \n    /**\n     * @ApiResource\n     * @ApiFilter(MultisearchFilter::class, properties={\"name\", \"description\", \"postalcode\":\"exact\", \"categories.name\"})\n     */\n    class MyEntity\n    {\n        private string $name;\n        private string $description;\n        private string $postalcode;\n        private Collection $categories;\n\n## GeoDistance filter\n\n### Configuration\n\nEdit `config/packages/doctrine.yaml`\n\n    doctrine:\n        orm:\n            dql:\n                numeric_functions:\n                    acos: DoctrineExtensions\\Query\\Mysql\\Acos\n                    cos: DoctrineExtensions\\Query\\Mysql\\Cos\n                    radians: DoctrineExtensions\\Query\\Mysql\\Radians\n                    sin: DoctrineExtensions\\Query\\Mysql\\Sin\n\n### Usage\n\n    use PhpGuild\\ApiBundle\\Doctrine\\Orm\\Filter\\GeoDistanceFilter;\n    \n    /*\n     * @ApiResource\n     * @ApiFilter(GeoDistanceFilter::class, attributes={\"latPropertyName\":\"lat\", \"lngPropertyName\":\"lng\"})\n     */\n    class MyEntity\n    {\n        private float $lat;\n        private float $lng;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpguild%2Fapi-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpguild%2Fapi-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpguild%2Fapi-bundle/lists"}