Michał Pipa
Paul Erdős (1913–1996) was an influential mathematician who spent a large portion of his later life writing papers with a large number of colleagues, working on solutions to outstanding mathematical problems. He published more papers during his lifetime (at least 1,525) than any other mathematician in history.
The Erdős number describes the "collaborative distance" between a person and mathematician Paul Erdős, as measured by authorship of mathematical papers.
To be assigned an Erdős number, someone must be a coauthor of a research paper with another person who has a finite Erdős number. Paul Erdős has an Erdős number of zero. Anybody else's Erdős number is k + 1 where k is the lowest Erdős number of any coauthor.
# of Mariusz Gil PHPCon talks - # of your PHPCon talks
Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
Symfony2 is also a full-stack web framework.
Symfony2 is an HTTP framework; it is a Request/Response framework.
<?php
class Newsletter
{
private $mailer;
public function __construct()
{
$this->mailer = new Mailer();
}
}
<?php
$newsletter = new Newsletter();
<?php
class Newsletter
{
private $mailer;
public function __construct(Mailer $mailer)
{
$this->mailer = $mailer;
}
}
<?php
$mailer = new Mailer();
$newsletter = new Newsletter($mailer);
<?php
class Newsletter
{
private $mailer;
public function __construct(Mailer $mailer)
{
$this->mailer = $mailer;
}
}
<?php
$mailer = new FakeMailer();
$newsletter = new Newsletter($mailer);
# app/config/config.yml
services:
mailer:
class: Mailer
newsletter:
class: Newsletter
arguments: ["%mailer%"]
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
// ...
$newsletter = $container->get('newsletter');
Provides tools that allow your application components to communicate with each other by dispatching events and listening to them.
<?php
use Symfony\Component\EventDispatcher\EventDispatcher;
$dispatcher = new EventDispatcher();
<?php
$event = new Event();
$dispatcher->dispatch('order.create', $event);
<?php
class OrderListener
{
public function onCreate(Event $event)
{
// do something
}
}
<?php
$listener = new OrderListener();
$dispatcher->addListener('order.create', array($listener, 'onCreate'));
# app/config/config.yml
services:
kernel.listener.order_listener:
class: OrderListener
tags:
- { name: kernel.event_listener, event: order.create, method: onCreate }
The HttpFoundation component defines an object-oriented layer for the HTTP specification.
The HttpKernel component provides a structured process for converting a Request into a Response by making use of the EventDispatcher.
<?php
namespace Symfony\Component\HttpKernel;
use Symfony\Component\HttpFoundation\Request;
interface HttpKernelInterface
{
/**
* @return Response A Response instance
*/
public function handle(
Request $request,
$type = self::MASTER_REQUEST,
$catch = true
);
}
Typical Purposes: To add more information to the Request, initialize parts of the system, or return a Response if possible (e.g. a security layer that denies access).
<?php
namespace Symfony\Component\HttpKernel\Controller;
use Symfony\Component\HttpFoundation\Request;
interface ControllerResolverInterface
{
public function getController(Request $request);
public function getArguments(Request $request, $controller);
}
Typical Purposes: Initialize things or change the controller just before the controller is executed.
Typical Purposes: Transform a non-Response return value from a controller into a Response
Typical Purposes: Modify the Response object just before it is sent
Typical Purposes: To perform some "heavy" action after the response has been streamed to the user
<?php
// send the headers and echo the content
$response->send();
// triggers the kernel.terminate event
$kernel->terminate($request, $response);
Typical Purposes: Handle some type of exception and create an appropriate Response to return for the exception
3rd party libraries integration
Plugin, just fancy name