Download - PHP Frameworks and Symfony
![Page 1: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/1.jpg)
Symfony
![Page 2: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/2.jpg)
What is Symfony?➔a web application framework for PHP5 projects.
- Opensource, MIT license
- OOP
- MVC
➔by Fabien Potencier, SensioLabs (France)
- 2005. first version was released
- 2007. symfony 1.0
- 2011. Symfony2
- ATM Symfony 2.3.4 (LTS)
![Page 3: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/3.jpg)
Framework➔A software framework is a
universal, reusable software platform to develop applications, products and solutions.
➔Why?➔ Avoid “reinventing the
wheel”➔ Use proven, tested code➔ Maintainability
➔When?➔ general vs. specific needs
➔ packaged software➔ CMS (content
management system)➔ framework
![Page 4: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/4.jpg)
MVC (Model–view–controller)
➔The model consists of application data, business rules, logic, and functions.
➔A view can be any output representation of data, such as a chart or a diagram.
➔The controller mediates input, converting it to commands for the model or view.
View
ModelController
![Page 5: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/5.jpg)
some Symfony features...
Support for multiple platforms
Scaffolding - for CRUD templates
multilingualism and I18N support
Database Engine Independent
cache management
![Page 6: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/6.jpg)
Reasons to use Symfony1. Reputation
2. Permanence
3. References
4. Innovation
5. Resources
6. Interoperability
![Page 8: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/8.jpg)
What is inside?
![Page 9: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/9.jpg)
Console Commands
![Page 10: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/10.jpg)
Welcome!
![Page 11: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/11.jpg)
Creating Pages in Symfony2
1. Create a route2. Create a controller
![Page 12: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/12.jpg)
Routing (smart URLs )
✗http://cusearch09.com/user/upload/imageThumb.php?id=5&width=320
✔http://cusearch09.com/user/image/5/320
![Page 13: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/13.jpg)
Controller
class HelloController
{
public function indexAction($name)
{
return new Response('<html><body>Hello '.$name.'!</body></html>');
}
public function successAction()
{
return new Response('<html><body>Process succeeded!</body></html>');
}
}
![Page 14: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/14.jpg)
Modelclass Product{ /** @ORM\Id @ORM\Column(type="integer") */ protected $id; /** @ORM\Column(type="string", length=100) */ protected $name; /** @ORM\Column(type="decimal", scale=2) */ protected $price;
/** @ORM\Column(type="text") */ protected $description;}
![Page 15: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/15.jpg)
http://symfony.com
![Page 16: PHP Frameworks and Symfony](https://reader031.vdocuments.mx/reader031/viewer/2022020101/54b773064a7959756e8b4569/html5/thumbnails/16.jpg)
twitter.com/glennguden