PHPC6 | Web Development with Silex

  • This two days training course is the best started point for PHP developers who want to improve their knowledge in object oriented PHP web development and want to learn how modern full stack frameworks work. Silex is a microframework built around the Symfony components that enables any PHP developers to build their PHP applications on top of it using an object oriented approach. Thanks to its very lightweight kernel and many extensions, you will discover how to create modern full featured web applications using third party libraries like the Symfony components or Twig templating engine.
  • Prerequisites

    Good knowledge of the PHP language and object oriented programming.
  • Goals

    In two days, this training course enables you to get started with the famous Silex microframework built on top of the Symfony components. You will learn how Silex is designed and develop a real full featured MVC PHP application including HTTP caching, forms and validation, urls routing and database management. This course will also introduce some of the best practices in web development such as automated testing (unit and functional tests) with PHPUnit, clean code programming (dependency injection) and templating with Twig.

Full program

Introduction to Silex

  • What is a microframework ?
  • Installing Silex with Composer
  • The Silex architecture
  • The Symfony Components

HTTP Request Handling

  • Receiving a request object
  • Reading the request headers
  • Reading the request content
  • Sending a response object
  • Defining the response status code
  • Defining the response content
  • Defining the response headers

Routing Urls

  • Registering routes in the application
  • Namming routes
  • Creating dynamic urls
  • Constrainting route parameters
  • Mapping a route to an HTTP method (GET, POST, PUT, DELETE...)
  • Enabling route parameters converters
  • Generating urls according to the routing map

The Controller Layer

  • Convertir a request into a response
  • Triggering an HTTP redirect
  • Triggering an internal redirect
  • Redirecting the user to a 404 error page

The View Layer

  • Using PHP as a templating engine
  • Preventing the application againsts XSS attacks
  • Using with the Twig templating engine
  • Discovering the Twig templating syntax
  • Displaying the content of a Twig variable
  • Executing loops and conditions with Twig
  • Simplifying views with templates inheritance

Errors Handling

  • Processing 404 error pages
  • Processing 500 error pages
  • Processing generic HTTP error pages
  • Recording information in a logs file

Dependency Injection

  • Introduction to the dependency injection principle
  • Discovering the Pimple object
  • Registering global configuration parameters in Pimple
  • Registering services in Pimple
  • Invokating services on demand

Service Providers

  • Introduction to service providers
  • The session service provider
  • The Twig service provider
  • The HTTP cache service provider
  • The sécurité and firewall service provider
  • The logger service provider
  • The Doctrine service provider
  • The forms and validation service providers
  • The mailer service provider

HTTP Caching & Edge Side Includes

  • Introduction to HTTP cache
  • Discovering caching strategies: Expiration vs Validation
  • Caching contents on the client side (web browser)
  • Caching contents on the server side (reverse proxy caching)
  • Caching pieces of a web page with ESI

Functional Testing of a Silex Application

  • Installing PHPUnit
  • Discovering PHPUnit
  • Introduction to functional testing
  • Configuring the testing environment
  • Executing requests witht the Client object
  • Analyzing the response with the Crawler object

Advanced Usage of Silex

  • Executing code before or after a controller
  • Splitting controllers into several files
  • Overriding global configuration parameters
  • Designing new custom service providers
  • Extending an existing service provider
  • Duration

    2 day(s)
  • Level

    Beginner
  • Available languages

    French, English
  • Available countries

    France, Worldwide
From €1,290.00
No session scheduled

No session is scheduled for this course. However we organize tailored training courses: contact us for more informations!