Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielm/symfony-demo-bundle
Basic Symfony Bundle template/demo
https://github.com/danielm/symfony-demo-bundle
boilerplate bundle composer demo flex php recipe symfony template
Last synced: 24 days ago
JSON representation
Basic Symfony Bundle template/demo
- Host: GitHub
- URL: https://github.com/danielm/symfony-demo-bundle
- Owner: danielm
- License: mit
- Created: 2023-11-16T16:26:32.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-19T15:36:20.000Z (12 months ago)
- Last Synced: 2024-09-20T15:38:59.325Z (about 2 months ago)
- Topics: boilerplate, bundle, composer, demo, flex, php, recipe, symfony, template
- Language: PHP
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 Symfony Bundle Demo
[![Build Status](https://github.com/danielm/symfony-demo-bundle/workflows/Tests/badge.svg)](https://github.com/danielm/symfony-demo-bundle/actions/workflows/tests.yml)
[![Build Status](https://github.com/danielm/symfony-demo-bundle/workflows/PHPCsFixer/badge.svg)](https://github.com/danielm/symfony-demo-bundle/actions/workflows/php-cs-fixer.yml)
[![Build Status](https://github.com/danielm/symfony-demo-bundle/workflows/PHPStan/badge.svg)](https://github.com/danielm/symfony-demo-bundle/actions/workflows/php-stan.yml)See my blog post about this:
[https://danielmg.org/php/2023/02/extending-symfony-bundle-flex-recipes-and-private-repositories.html](https://danielmg.org/php/2023/02/extending-symfony-bundle-flex-recipes-and-private-repositories.html])
## About
This project is part of my Post series about how to build a Symfony Flex Recipes repository (private or not).
This bundle is a demo that shows a couple of things yo can do on a Symfony bundle, such as:
### Includes
- Console Command: `bin/console demo:command`
- DemoServiceInterface & DemoService: Example of some kind of Contract/Adapter-like patter of a service
- Events: Custom event `UnnecessaryEvent` and simple EventSubscriber `DemoSubscriber`
- DemoTwigExtension: Adds a twig function `demoFcn()`
- Controller:
- Route `/{a}/{b}` -> Simple endpoint that returns a Json response with some values and adds `a + b`
- Route `/view` -> Simple endpoint that renders a Twig template and returns HTML
- Route `/dispatch/{md5_hash}` -> Simple endpoint to test dispatching our `UnnecessaryEvent`
- Configuration
- Using Bundle config parameters
- Using Custom Env variables `DEMO_SAMPLE_ENV`
- Usage of Translations and public assets.## Install
### Using Symfony Recipe
```bash
composer require danielm/symfony-demo-bundle
```### Manually
Same `composer` command as using the Recipe, you will also need to create/edit some files manually (that's what a Symfony recipe does for you)...
## Composer scripts
Coding Standards (*follows symfony's default rules*)
```bash
# Displays errors
composer run cs:check
# Makes changes
composer run cs:fix
```
Testing
```bash
composer run test
```
PHP code analysis
```bash
composer run stan
```## Todo
- Validators examples
- Serialization examples
- Test Event & dispatcher