Symfony 2. The basics
By: Andrew Kovalyov
- Innovative and fun web agency since 2009
- A group of developers on Sf2 since 2010
- Contributing to the Symfony's ecosystem
- But also:
- Angular.JS
- Node.JS
- symfony 1.x
- Silex µframework
Agenda
- Why another framework?
- Composing your project dependencies.
- Doctrine ORM.
- Twig. One of the most flexible PHP template engines.
- Symfony2. Request-Response model.
- Work'em all
Why another framework?
Are you a coder or an engineer
What Symfony2 provides you
- Stable codebase
- Well-tested codebase
- Well-documented codebase
- Codebase which is supported by community
- Codebase which is written according to the latest standards and requirements in the industry
- Codebase is licensed under MIT license
Defined roadmap of releases
Pros
- Enterprise-ready
- Interoperability
- Great ecosystem of bundles
- Great documentation
- Development process is transparent
- Code is written according to best practices in the industry
Cons
- Hard to understand for juniors
- Rather slow compared to micro-frameworks
- Huge codebase
- Best practice as a result of experience
Decoupled from beginning
31 component as for Symfony2.7
Orchestrate your dependencies
https://getcomposer.org
Ecosystem of components
Time for action
Doctrine project
Do not write OOP. Think OOP.
Doctrine project
- ORM (Object Relational Mapper)
- DBAL (Database abstraction layer)
- Common (Autoloading, annotations parser, caching)
And more
- MongoDB Document Mapper
- PHPCR Document Mapper
- OrientDB Document Mapper
- CouchDB Document Mapper
- Migrations
So, what is ORM?
ORM in computer science is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language blah-blah-blah
(c) Wikipedia
So, WTF is ORM?
Let's see it in action
Twig
Templating for humans
Twig
- Fast
- Secure
- Flexible
- Extendible
- Human-friendly
- Template inheritance
- Template includes
- Sub-requests (Symfony2)
Let's see it in action too
Symfony2
Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
Then, based on these components
Symfony2 is also a full-stack web framework
Symfony2 flow
Oops
Symfony2 Request-Response
Symfony2 flow
Let's combine it all together.
Conclusions
- It was just a quick introduction into Symfony2 world.
- It was a quick introduction into Symfony2 itself.
- You should be the engineer who decides either to write the code or write the application.
- But. If you want to be an engineer - you should at least be familiar with the best practices in PHP world.
- You have survived and the pizza is near.
Thank you.
I am ready for questions.
Symfony basics
By akovalyov
Symfony basics
- 882