The Symfony Demo application is a fully-functional Symfony application developed as a learning resource and the reference implementation of the Symfony Best Practices.
This application was introduced in April 2015 and the 1.0.0 version was tagged on February 7th, 2017. A lot of changes and improvements have been added to the application since the last time we talked about it:
- 2731bae, f8d63f8: added a paginator based on PagerFanta (@ccab)
- e2d723c: added an example about how to use multiple form buttons (@voronkovich)
- 4dd93aa: added a Date Picker form field to show how to define custom types (@yceruto)
- 96bbeae: made error pages translatable (@bocharsky-bw)
- 895c518: added an example of how to use ESI caching (@sergiu-popa)
- 15ef2b7: updated the application's code to use as many modern PHP features as possible (@voronkovich)
- d8ecd9f: stopped using Assetic to manage assets (@javiereguiluz)
- 84de97a: used dynamic environment variables for critical configuration options (@dzuelke)
- 4d93cda: added a RSS channel for blog posts (@yceruto)
- e702851: added more examples of Doctrine relationships (@yceruto)
- ebca80b: added a security voter to manage blog post permissions (@yceruto)
- 963c260: allow blog posts to add tags using JavaScript widgets and Symfony Form data transformers (@yceruto)
- ... and hundreds of other minor fixes and tweaks
In addition to being a learning resource, the Symfony Demo application can
be used to showcase Symfony features, reproduce reported bugs, do performance
benchmarks, etc. Thanks to the Symfony installer you can get it just by
running the symfony demo
command.
Finally, we would like to warmly thank the great work of our contributors, specially Yonel Ceruto, Victor Bocharsky, Oleg Voronkovich and Christophe Coevoet. If you want to support this project, don't forget to star the Symfony Demo project on GitHub.
Waouw, that's really awesome. I like the fact we've a btn to see the current code of the page.
Really nice work guys!
Two things I want to ask:
Thanks.
@dan those are very good questions!
I think an API solution to CRUD blog posts also should be added to the demo. I think that frontend have moved away from using "static" PHP.
Regarding annotations, importing a namespace makes the code more readable when you have multiple set of annotations in your entity (ORM, Validator, etc...) and lots of annotations coming from this namespace. But this is a matter of preferences.
Regarding the assets processing, you can keep using Assetic if it suits your need. I'm personally in the process of switching to a stack using the node tools directly (and having a
npm run watch
command in dev).@Martin Aarhof: There is a demo application of API Platform (an API framework built on top of Symfony I maintain) available here: https://demo.api-platform.com/
For assets, I also use frontend tools (Webpack). Splitting the frontend part (SPA) from the backend part (API) gain popularity in all ecosystems. Facebook provide a nice tool to bootstrap a SPA using React including assets management, debugging tools, linting, deployment options... https://github.com/facebookincubator/create-react-app
https://github.com/symfony/symfony-demo/blob/master/src/AppBundle/Controller/BlogController.php#L100-L123
This is not a best practice, not in my book - Others mentioned before me, what happens when you want to create an API for that action?
I think you should be encouraging people to create services for these kinds of things - otherwise, people will just create massive controllers - just like I did 5 years ago when I was starting with Symfony. It took me years to figure out that's not how you write good software.
That's not to say I think the demo app is bad, but we might need to do some work to improve it and help people realize there's a more 'enterprise' way of writing code that comes with great benefits as well. I'm happy to help further this.
This is pretty good. Reverse Engineering this will be fun.
It's great. It would not hurt to have a demo for a bundle, so represent best practices for him.
I also think this is great, I remember starting out about 3 years ago and there was a demo application that I was using to learn Symfony, I think it was on tutorial.symblog.co.uk. So a demo supported by Symfony itself would be a great resource especially for beginners. The more demo apps the better :)
By the way, I have also gone on to also create a Symfony and EmberJS kickstart that you can find on github https://github.com/campus-discounts/embersy
Hi @Damjan Znidarsic. Which is the best way to manage form submission and get rid of that code inside controllers?
Great Thing !! Many thanks!