{"id":21069403,"url":"https://github.com/mustafamagdi/symfony4","last_synced_at":"2026-05-20T15:33:45.872Z","repository":{"id":145727344,"uuid":"119167948","full_name":"MustafaMagdi/Symfony4","owner":"MustafaMagdi","description":"Symfnoy4 boilerplate using Flex with ReactPHP supported.","archived":false,"fork":false,"pushed_at":"2018-06-25T20:40:43.000Z","size":119,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-20T21:44:29.328Z","etag":null,"topics":["flex","php7","reactphp","symfony4"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MustafaMagdi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-27T13:44:04.000Z","updated_at":"2021-12-19T17:27:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"e199bb87-2245-4251-ae44-5ef7e209d3db","html_url":"https://github.com/MustafaMagdi/Symfony4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MustafaMagdi%2FSymfony4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MustafaMagdi%2FSymfony4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MustafaMagdi%2FSymfony4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MustafaMagdi%2FSymfony4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MustafaMagdi","download_url":"https://codeload.github.com/MustafaMagdi/Symfony4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243510929,"owners_count":20302471,"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":["flex","php7","reactphp","symfony4"],"created_at":"2024-11-19T18:35:01.564Z","updated_at":"2025-12-29T15:10:09.271Z","avatar_url":"https://github.com/MustafaMagdi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symfony4\nSymfnoy4 using Flex with [ReactPHP](https://reactphp.org/) supported.\n\n# Purpose\nWe didn't re-invent the wheel here, we are just coming up with the latest updates from Symfony4 with some customizations to make it fit your usage in your microservices architecture.\n\n# What Do We Have\n* [x] Symfony with Flex module.\n* [x] Add ReactPHP.\n* [x] Restful support (Simple).\n* [x] Custom `ControllerTrait`.\n* [x] [Middleware](https://symfony.com/doc/current/event_dispatcher/before_after_filters.html).\n* [x] CORS [NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle).\n* [x] GWT [LexikJWT](https://github.com/lexik/LexikJWTAuthenticationBundle).\n* [x] Add Debug via parameters (like sending `_profile` as a param).\n* [x] Basic Authentication.\n* [x] Basic AccessControl.\n* [ ] Unify the response body/add a pattern.\n* [ ] Add `ExceptionalTrait`.\n* [x] Use [PSR-7 Bridge](https://symfony.com/doc/current/components/psr7.html) with ReactPHP.\n* [x] Clean the code.\n* [ ] Integrate [blackfire.io](https://blackfire.io/).\n* [ ] Add tests.\n\n# Documentation\n* [x] Why.\n* [ ] Why Symfony.\n* [x] How to setup.\n* [x] Run the app.\n* [x] Installing new packages.\n* [x] Profiling.\n* [x] How to integrate JWT with Symfony security system.\n* [x] How to create a new endpoint.\n* [x] References for Symfony4.\n\n### Why\nAdd the minimal amount of components and services that serve the needs of having Restful API following the standards.\n\n### Why Symfony\nWait for it.\n\n### How to setup\n1. Clone the repo:\n```ssh\ngit clone https://github.com/MustafaMagdi/Symfony4.git\n```\n\n2. Install packages:\n```ssh\ncd Symfony4 \u0026\u0026 composer install\n```\n\n3. Configure `.env` file:\n```ssh\ncp .env.dist .env\n```\n\n4. Generate SSH keys for [LexikJWT](https://github.com/lexik/LexikJWTAuthenticationBundle):\n```ssh\n$ mkdir -p var/jwt\n$ openssl genrsa -out var/jwt/private.pem -aes256 4096\n$ openssl rsa -pubout -in var/jwt/private.pem -out var/jwt/public.pem\n```\nIt might asks you for passphrase, provide it and add it to your `.env` file:\n```ssh\nJWT_PASSPHRASE=whatever\n```\n\n5. Configure [NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle), check your `config/packages/nelmio_cors.yaml` file.\n\nAnd now, you run the application:\n\n### Run the app\n1. For the regular setup:\n```ssh\n./bin/console server:run\n```\n\n2. For ReactPHP:\n```ssh\nphp public/index.react.php\n```\n\n### Installing new services\nBefore you start searching in [Packagist](https://packagist.org/), have a look at [Symfony.sh](https://symfony.sh/) which is a hub for Symfony services configuration. It is playing with [Symfony flex](https://github.com/symfony/flex) and [Symfony recipes](https://github.com/symfony/recipes) a really nice role in Symfony4.\n\nI am going to provide more details about it soon.\n\n### Profiling\nSymfony is already coming up with a really nice [Profiler Component](https://symfony.com/doc/current/profiler.html), \nto see the nice profiler bar in browser, just send `_profiler` param in your request, it even dumps the response body.\n\nOn development env, you still can open the profiler url form the response header, just check the `X-Debug-Token-Link`.\n\n### How to integrate JWT with Symfony security system\nIn order to understand how Symfony security system is working, check [the documentation here](https://symfony.com/doc/current/security.html).\nWe have two steps to configure JWT with Symfony security system:\n\nOne second, if you are not aware about JWT, just check [jwt.io](https://jwt.io/).\n\n##### 1. Login the user:\nYou need to generate the token for the user:\n```ssh\nController/AuthController.php:generateToken\n```\n\n##### 2. Validate the user:\nBy defining the authenticator class in `config/packages/security.yaml`:\n```yaml\n        guard:\n            authenticators:\n                - App\\Security\\JwtTokenAuthenticator\n```\nCheck `App\\Security\\JwtTokenAuthenticator:getUser`, which you decode the token and match with your DB user record, \nthen, you return the `Symfony\\Component\\Security\\Core\\User` object with a dummy user role that should match what we \nhave in `security.yaml`:\n```yaml\n    access_control:\n        - { path: ^/profile, roles: ROLE_USER }\n```\n\n### How to create a new endpoint\nIt is very simple, you will notice at the docblock of the controller functions:\n```php\n    /**\n     * @Route(\"/auth\") // where you provide the route\n     * @Method({\"POST\"}) // where you provide the HTTP method\n     * ...\n     */\n```\n\n### References for Symfony4\nIn order to involve in Symfony:\n1. For sure, it is [Symfony's website](http://symfony.com/doc/current/index.html).\n2. [Symfony's blog](http://symfony.com/blog/), they have \"A week of Symfony\" is being release in a weekly basis with \nall the updates.\n3. [KNP Symfony](https://knpuniversity.com/search?q=symfony) there are some courses introduced by [weaverryan](https://github.com/weaverryan), I really like the way he is introducing them. Thanks you @weaverryan.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafamagdi%2Fsymfony4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustafamagdi%2Fsymfony4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafamagdi%2Fsymfony4/lists"}