php 2013

49
PHP 2013 Raúl Fraile

Upload: alicantephp

Post on 13-Jul-2015

398 views

Category:

Technology


1 download

TRANSCRIPT

PHP 2013Raúl Fraile

thegreenbees.es nitsnets.com

proweb.ua.es servergrove.es

sharedsecrets.com cloid.net

Antes de empezar...

Próxima reunión: Lunes 17 de Junio

Pablo GodelDespliegue de aplicaciones PHP

Fundador de ServerGroveCreador de la mailing-list de PHP en español

Viviendo en USA desde 1999

PHP 5.3+

1.0 08-06-19952.0 01-11-19973.0 06-06-19984.0 22-05-20005.0 13-07-20045.1 24-11-20055.2 02-11-20065.3 30-06-20095.4 01-03-2012

5.5 RC1 09-05-2013

Futuras versiones: releases más frecuentes

PHP 5.3: Namespaces, closures, PHAR...

<?php namespace Ladybug\Theme; use Ladybug\Format\FormatInterface;use Ladybug\Container; abstract class BaseTheme implements ThemeInterface{  /** @var Container $container */ protected $container;  protected $formats;  public function __construct(Container $container) { $this->container = $container; }}

<?php $values = range(1, 30); $evenNumbers = array_filter($values, function($number) { return ($number % 2) == 0;});

PHP 5.4: Traits, sintaxis corta para arrays, servidor web...

<?php trait Loggable { public function log() { // my log function }} class Car { use Loggable;} $car = new Car();$car->log();

Composer

Gestor de dependencias para PHP

{ "require": { "doctrine/orm": "2.2.3" }}

{ "require": { "doctrine/orm": "2.2.*" }}

{ "require": { "doctrine/orm": ">=2.2.3" }}

{ "require": { "doctrine/orm": ">=2.2.3" }, "require-dev": { "mockery/mockery": "0.8.0" }}

composer.json VS composer.lock

packagist.org

security.sensiolabs.org

Estándares

Framework Interop Group

www.php-fig.org

PSR-0: Autoloading

Se lanza cuando se intenta utilizar una clase o

interface no definido previamente

Traductor namespace -> archivo

∖Doctrine∖DBAL∖Driver [lib_path]/Doctrine/DBAL/Driver.php

bool spl_autoload_register( [callable $autoload_function, [bool $throw = true, [bool $prepend = false]]])

PSR-1/2: Coding Standard

Importante: elegir un CS y ser consistente

Proyectos open source: compartir mismo CS

PSR-3: Logger Interface

namespace Psr\Log;

interface LoggerInterface{ /** * System is unusable. */ public function emergency($message, array $context = array());  /** * Action must be taken immediately. */ public function alert($message, array $context = array());  /** * Critical conditions. */ public function critical($message, array $context = array());  /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. */ public function error($message, array $context = array());  /** * Exceptional occurrences that are not errors. */ public function warning($message, array $context = array());  ...

Symfony

Más que un framework

Componentes independientes y desacoplados

BrowserKit

ClassLoader

Config

Console

CssSelector

DependencyInjection

DomCrawler

EventDispatcher

Finder

Form

HttpFoundation

HttpKernel

Locale

Process

Routing

Security

Serializer

Templating

Translation

Validator

Yaml

StopWatch

PropertyAccessOptionsResolver

Comunidad

Conferencias

Buena oportunidad para aprender y hacer contactos

desymfony.com

GitHub

Tu verdadero CV

raulfraile/Ladybug

symfony2cheatsheet.com

Less talk, more code

¿Preguntas?