Mastering Symfony
eBook - ePub

Mastering Symfony

Sohail Salehi

Buch teilen
  1. 290 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Mastering Symfony

Sohail Salehi

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Orchestrate the designing, development, testing, and deployment of web applications with Symfony

About This Book

  • Create a robust and reliable Symfony development pipeline using Amazon's cloud platform
  • Cut development and maintenance costs by defining crystal clear features and possible scenarios for each feature before implementation
  • Follow detailed examples provided in each chapter to create a task management application

Who This Book Is For

If you are a PHP developer with some experience in Symfony and are looking to master the framework and use it to its full potential, then this book is for you. Though experience with PHP, object-oriented techniques, and Symfony basics is assumed, this book will give you a crash course on the basics and then proceed to more advanced topics.

What You Will Learn

  • Install and configure Symfony and required third-party bundles to develop a task management application
  • Set up a continuous integration server to orchestrate automatic builds every time you add a new feature to your project
  • Reduce maintenance costs dramatically using Behaviour Driven Development (BDD)
  • Create a slick user interface using the Bootstrap framework
  • Design robust business logic using Doctrine
  • Build a comprehensive dashboard and secure your project using the Sonata project
  • Improve performance using Redis, Memcache, and Varnish
  • Create customized Symfony commands and add them to your console

In Detail

In this book, you will learn some lesser known aspects of development with Symfony, and you will see how to use Symfony as a framework to create reliable and effective applications. You might have developed some impressive PHP libraries in other projects, but what is the point when your library is tied to one particular project? With Symfony, you can turn your code into a service and reuse it in other projects.

This book starts with Symfony concepts such as bundles, routing, twig, doctrine, and more, taking you through the request/response life cycle. You will then proceed to set up development, test, and deployment environments in AWS. Then you will create reliable projects using Behat and Mink, and design business logic, cover authentication, and authorization steps in a security checking process. You will be walked through concepts such as DependencyInjection, service containers, and services, and go through steps to create customized commands for Symfony's console. Finally, the book covers performance optimization and the use of Varnish and Memcached in our project, and you are treated with the creation of database agnostic bundles and best practices.

Style and approach

A step-by-step guide to mastering Symfony while developing a task management application. Each chapter comes with detailed examples.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Mastering Symfony als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Mastering Symfony von Sohail Salehi im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatica & Programmazione in PHP. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2016
ISBN
9781784390310

Mastering Symfony


Table of Contents

Mastering Symfony
Credits
About the Author
About the Reviewers
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Installing and Configuring Symfony
Why Symfony?
Influenced by Symfony
How bright is the future?
Installation
Composer and Packagist
Installing Symfony via Composer
The road map
Checking the installation
Summary
2. The Request and Response Life Cycle
The big picture
Anatomy of a bundle
Generating a new bundle
Best practices
Custom bundles versus AppBundle
Creating templates with TWIG
Controller/View interaction
Conditional templates
Make it dynamic
Database configurations
Generating an entity
Installing bundles created by others
Creating data fixtures
Loading data fixtures
Dynamic templates and controllers
The big picture with MVC
Summary
3. Setting Up the Environment
The importance of Continuous Integration
Amazon Web Services
Elastic Compute Cloud
Creating a new instance
Setting up the server
Installing Apache
Installing MySQL and PHP
Installing Jenkins
Setting up security and installing plugins in Jenkins
Simple Email Service
Configuring Jenkins
Installing PHP tools
Sniff Symfony codes
Orchestrating the build process
Creating a new job in Jenkins
Running the first build
How does GitHub alert Jenkins about new pushes?
Do I need CI?
Summary
4. Using Behavior-Driven Development in Symfony
Getting started with BDD
Is BDD a replacement for TDD?
What is Behat?
Installing and configuring Behat
The features we need for this project
More information about the project
Gherkin – the common language
Writing a scenario for the about page
Seeing it in action
Headless versus zombie
Using the Selenium2 controller for automated tests
The about page does not follow BDD
A scenario to show the user's details
Implementing the user's details scenario
Testing the scenario
More about the acceptance test flow in Mink
Defining and prioritizing features
Codeception – the BDD style testing framework
Installing the Codeception framework
Bootstrapping Codeception
Test suits
The testers
Adding sample tests
Running the tests
Summary
5. Business Logic
Choosing between creating a Model or entity
So where does the business logic live?
Reviewing the facts and building entity relationships
Creating ERDs using MySQL Workbench
Adding a new entity
Adding a new relationship
Creating actual tables from a diagram
Generating entities
Data fixtures
Some business logic features and scenarios
TDD and BDD with Codeception
Step one – creating a functional test
Developing the missing code
Step two – creating the unit tests
Setting up the database for a test environment in the right way
Dropping and recreating the database for each test
Creating unit tests
Writing the code to pass the test
Running functional and unit tests
Step three – creating an acceptance test
On the CI side of the story
Summary
6. Dashboard and Security
How security is organized in Symfony?
Authentication
Authorization
Handling users with FOSUserBundle
Security settings
Adding the required configurations to FOSUserBundle
Adding routes
Updating the tables
A simple road test
Generating automated data fixtures
Introducing AliceBundle
Creating data fixtures with Alice
Relationship with Alice
Setting up the login redirection
Creating tests for the new controller
Creating the Dashboard Controller
Securing the dashboard
The Sonata project
Installing and configuring Sonata bundle
Adding contents to the dashboard
Creating admin feature for entities with relations
Integrating FOSUserBundle into the admin area
Installing SonataUserBundle
SonataUserBundle configuration
Updating the routes
Setting the security
Checking the installation
Putting SonataUserBundle in charge
User dashboard
Generating CRUD
Modifying the forms
Summary
7. The Presentation Layer
How assets are organized
Asset management
How templates are organized
Let's mold the clay
To navigate or not to navigate
What is Bootstrap?
MopaBootstrapBundle
Bootstrap configuration
Creating your first menu
Rendering the menu in a template
The Dashboard template
Overriding templates
Profile-related templates
Changing the backend logo
Summary
8. Project Review
The dashboard's contents
Visual blocks that provide statistics about tasks
A feature file for the finished tasks block
Implementing the finished tasks block
Implementing the dashboard controller
Uploading files with SonataMediaBundle
Adding an attachment feature to the Task entity
Team and team members
The Team entity
Adding a notification system
Adding time tracking properties
The notification business logic
Events, event dispatchers, and event listeners
The Notifier event listener
Summary
9. Services and Service Containers
How to create a service
How are services beneficial to our projects?
How to call a service
How to configure a service
Why is it called a Dependency Injection Container?
Why didn't we import services inside the bundle?
How to create and load services via autowiring
Organizing services with tags
Summary
10. Custom User Commands
Creating and registering commands
Creating commands for tasks
The configuration part
The execution part
Adding interactivity to commands
Console helpers
Summary
11. More about Dev, Test and Prod Environments
Why do we need different environments?
The environment configuration file
Processing configuration files
Creating a new environment
The config file
The front controller
Summary
12. Caching in Symfony
Definition of a cache
Characteristics of a good cache
Caches in a Symfony project
Key players in the HTTP cache header
Using the Symfony reverse proxy cache
Set expiration for dashboard page
Validation strategy
How to mix expiration and validation strategies
Doctrine cache
Putting it all together
ESI for selective caching
Sophisticated bundles
Summary
Index

Maste...

Inhaltsverzeichnis