SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
PHP Frameworks, Libraries & Tools

BarCamp Rhein Main 2013
Lukas Rosenstock
Overview
●

PHP 5.3: Namespaces, Autoloading and PSR-0

●

Composer & Packagist Dependency Manager

●

Silex Microframework & symfony components

●

Twig Template Engine

●

Guzzle HTTP Library

●

Doctrine Object-Relational-Mapper
PHP 5.3
●

Namespace declaration:
–
–

●

namespace LukasRosenstockEvents;
class BarCamp { }

Use classes:
–

–

or

–

use LukasRosenstockEventsBarCamp;

–
●

$bcrm13 = new LukasRosenstockEventsBarCamp;

$bcrm13 = new BarCamp;

PSR0 Guideline: namespace = path
–

●

/LukasRosenstock/Events/BarCamp.php

Autoloading → magic 'require' when needed
Composer & Packagist
●

Per-project dependency management for
frameworks, libraries etc.
–

●

Command-line tool composer.phar
–

●

Dependencies are not included in project repository
composer install

JSON configuration files composer.json for
each package
–
–

●

Public package names → http://packagist.org/
Custom repositories and downloads

http://getcomposer.org/
Silex Microframework
●

Microframework = single PHP file for multiple
URL patterns
–
–

●

Good for RESTful APIs
Requires URL rewriting in webserver

Implementation with closures
–
–

$app->get('/event/{id}', function($id) { return 'You
have requested event '.$id; });

–

$app->post('/event/{id}', function($id, Request $r) {
return 'Event updated with '.$r->getContent(); });

–
●

$app = new SilexApplication;

$app->run();

http://silex.sensiolabs.org/
Twig Template Engine
●

Separation logic and view

●

Frontend developers should not write PHP
–

●

Twig has own syntax for conditions, loops etc.

Template:
–
–

●

<h1>Event {{name}}</h1>
{% if is_today %}<p>Happening today.</p>{% endif %}

PHP Code:
–
–

●

$twig = new Twig_Environment(new
Twig_Loader_Filesystem('/views'));
Return $twig->render('event.twig.html', array('name'
=> $event->getName(), 'is_today' => $event>getDate()==$now);

http://twig.sensiolabs.org/
Guzzle HTTP Library
●

OOP abstraction layer for libcurl

●

Extendable with plugins

●

Service definitions for webservice API clients
–

●

Amazon WebServices PHP SDK

Example:
–
–

$client->setDefaultHeaders(array('Authorization' =>
'Bearer '.$accessToken));

–

$response = $client->get('/event/bcrm13')->send();

–
●

$client = new
GuzzleHttpClient('http://api.example.com/');

$eventData = $response->json();

http://guzzlephp.org/
Doctrine Object-Relational-Mapper
●

1 SQL table = 1 PHP class
–

●

Mapping of fields and relations defined with
annotations (comments) or in external configuration
files

Sample fields:
–
–

/** @Column(type="string") **/ private $name;

–

●

/** @Id @Column(type="integer") **/ private $id;
/** @OneToOne(targetEntity="User") **/ private
$organizer;

Creating Entity:
–

$event = new LukasRosenstockEventsBarCamp;

–

$em->persist($event); // em = EntityManager

–

$em->flush();
Doctrine Object-Relational-Mapper
●

Fetching Entity:
–

●

$event = $em>getRepository('LukasRosenstockEventsBarCamp')>findOneById(1);

Modifying Entity:
–
–

$event->setOrganizer($user);

–
●

$user = new LukasRosenstockEventsOrganizer;
$em->flush();

http://www.doctrine-project.org/
Thank you!

Questions?!

Contenu connexe

Tendances

GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016Alex Van Boxel
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Daniel Londero
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...AboutYouGmbH
 
Streaming analytics with Python and Kafka
Streaming analytics with Python and KafkaStreaming analytics with Python and Kafka
Streaming analytics with Python and KafkaEgor Kraev
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPCGuo Jing
 
Debugging applications with network security tools
Debugging applications with network security toolsDebugging applications with network security tools
Debugging applications with network security toolsConFoo
 
Generating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPCGenerating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPCC4Media
 
gRPC & Kubernetes
gRPC & KubernetesgRPC & Kubernetes
gRPC & KubernetesKausal
 
HTTP/2 and SSL/TLS state of art in ASF servers
HTTP/2 and SSL/TLS state of art in ASF serversHTTP/2 and SSL/TLS state of art in ASF servers
HTTP/2 and SSL/TLS state of art in ASF serversJean-Frederic Clere
 
Thruk Monitoring Gui
Thruk Monitoring GuiThruk Monitoring Gui
Thruk Monitoring GuiSven Nierlein
 
Docker for mac & local developer environment optimization
Docker for mac & local developer environment optimizationDocker for mac & local developer environment optimization
Docker for mac & local developer environment optimizationRadek Baczynski
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Codemotion
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeLenz Gschwendtner
 
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQPROIDEA
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and ImplementationVarun Talwar
 
XMPP & AMQP
XMPP & AMQPXMPP & AMQP
XMPP & AMQPvoluntas
 
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07it-novum
 

Tendances (20)

GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 
Streaming analytics with Python and Kafka
Streaming analytics with Python and KafkaStreaming analytics with Python and Kafka
Streaming analytics with Python and Kafka
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
Debugging applications with network security tools
Debugging applications with network security toolsDebugging applications with network security tools
Debugging applications with network security tools
 
Generating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPCGenerating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPC
 
gRPC & Kubernetes
gRPC & KubernetesgRPC & Kubernetes
gRPC & Kubernetes
 
HTTP/2 and SSL/TLS state of art in ASF servers
HTTP/2 and SSL/TLS state of art in ASF serversHTTP/2 and SSL/TLS state of art in ASF servers
HTTP/2 and SSL/TLS state of art in ASF servers
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
 
Thruk Monitoring Gui
Thruk Monitoring GuiThruk Monitoring Gui
Thruk Monitoring Gui
 
Docker for mac & local developer environment optimization
Docker for mac & local developer environment optimizationDocker for mac & local developer environment optimization
Docker for mac & local developer environment optimization
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
 
Ruby e xmpp
Ruby e xmppRuby e xmpp
Ruby e xmpp
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = Awesome
 
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ
4Developers: Łukasz Łysik- Message-driven architecture with RabbitMQ
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
XMPP & AMQP
XMPP & AMQPXMPP & AMQP
XMPP & AMQP
 
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07
openATTIC & Ceph Management @ Suse Monthly Open Source Talks - 2016-06-07
 

En vedette (7)

App.net Introduction
App.net IntroductionApp.net Introduction
App.net Introduction
 
Das IndieWeb - mach mit!
Das IndieWeb - mach mit!Das IndieWeb - mach mit!
Das IndieWeb - mach mit!
 
OpenID for starters - Barcamp Berlin II
OpenID for starters - Barcamp Berlin IIOpenID for starters - Barcamp Berlin II
OpenID for starters - Barcamp Berlin II
 
2016 Younique Catalog. YouniqueByEllen.com
2016 Younique Catalog.  YouniqueByEllen.com2016 Younique Catalog.  YouniqueByEllen.com
2016 Younique Catalog. YouniqueByEllen.com
 
Hybride Entwicklung mit Ionic
Hybride Entwicklung mit IonicHybride Entwicklung mit Ionic
Hybride Entwicklung mit Ionic
 
OpenID für Anfänger - MRMCD
OpenID für Anfänger - MRMCDOpenID für Anfänger - MRMCD
OpenID für Anfänger - MRMCD
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similaire à PHP Frameworks, Libraries & Tools - BarCamp RheinMain 2013

Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopChris Tankersley
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?Wong Hoi Sing Edison
 
Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentSadique Puthen
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013Andy Bunce
 
Guideline paper@rpi full_stack_python_arch
Guideline paper@rpi full_stack_python_archGuideline paper@rpi full_stack_python_arch
Guideline paper@rpi full_stack_python_archAnthony Le Goff
 
Introducing Koki Short
Introducing Koki ShortIntroducing Koki Short
Introducing Koki ShortSidhartha Mani
 
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOVirtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOPaolo Cristofaro
 
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarTimothy Spann
 
Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置YUCHENG HU
 
Last Month in PHP - May 2016
Last Month in PHP - May 2016Last Month in PHP - May 2016
Last Month in PHP - May 2016Eric Poe
 
PhillyJug Getting Started With Real-time Cloud Native Streaming With Java
PhillyJug  Getting Started With Real-time Cloud Native Streaming With JavaPhillyJug  Getting Started With Real-time Cloud Native Streaming With Java
PhillyJug Getting Started With Real-time Cloud Native Streaming With JavaTimothy Spann
 
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with dockerMaciej Lukianski
 
Submit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовSubmit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовBinary Studio
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPSPaolo Tonin
 
PHPCR - Standard Content Repository for PHP
PHPCR - Standard Content Repository for PHPPHPCR - Standard Content Repository for PHP
PHPCR - Standard Content Repository for PHPHenri Bergius
 

Similaire à PHP Frameworks, Libraries & Tools - BarCamp RheinMain 2013 (20)

Composer
ComposerComposer
Composer
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Rebuilding our Foundation
Rebuilding our FoundationRebuilding our Foundation
Rebuilding our Foundation
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 Workshop
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
 
Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deployment
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
 
Guideline paper@rpi full_stack_python_arch
Guideline paper@rpi full_stack_python_archGuideline paper@rpi full_stack_python_arch
Guideline paper@rpi full_stack_python_arch
 
Introducing Koki Short
Introducing Koki ShortIntroducing Koki Short
Introducing Koki Short
 
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOVirtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
 
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
 
Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置
 
Last Month in PHP - May 2016
Last Month in PHP - May 2016Last Month in PHP - May 2016
Last Month in PHP - May 2016
 
PhillyJug Getting Started With Real-time Cloud Native Streaming With Java
PhillyJug  Getting Started With Real-time Cloud Native Streaming With JavaPhillyJug  Getting Started With Real-time Cloud Native Streaming With Java
PhillyJug Getting Started With Real-time Cloud Native Streaming With Java
 
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
 
Submit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовSubmit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло Морозов
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPS
 
PHPCR - Standard Content Repository for PHP
PHPCR - Standard Content Repository for PHPPHPCR - Standard Content Repository for PHP
PHPCR - Standard Content Repository for PHP
 

Dernier

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

PHP Frameworks, Libraries & Tools - BarCamp RheinMain 2013

  • 1. PHP Frameworks, Libraries & Tools BarCamp Rhein Main 2013 Lukas Rosenstock
  • 2. Overview ● PHP 5.3: Namespaces, Autoloading and PSR-0 ● Composer & Packagist Dependency Manager ● Silex Microframework & symfony components ● Twig Template Engine ● Guzzle HTTP Library ● Doctrine Object-Relational-Mapper
  • 3. PHP 5.3 ● Namespace declaration: – – ● namespace LukasRosenstockEvents; class BarCamp { } Use classes: – – or – use LukasRosenstockEventsBarCamp; – ● $bcrm13 = new LukasRosenstockEventsBarCamp; $bcrm13 = new BarCamp; PSR0 Guideline: namespace = path – ● /LukasRosenstock/Events/BarCamp.php Autoloading → magic 'require' when needed
  • 4. Composer & Packagist ● Per-project dependency management for frameworks, libraries etc. – ● Command-line tool composer.phar – ● Dependencies are not included in project repository composer install JSON configuration files composer.json for each package – – ● Public package names → http://packagist.org/ Custom repositories and downloads http://getcomposer.org/
  • 5. Silex Microframework ● Microframework = single PHP file for multiple URL patterns – – ● Good for RESTful APIs Requires URL rewriting in webserver Implementation with closures – – $app->get('/event/{id}', function($id) { return 'You have requested event '.$id; }); – $app->post('/event/{id}', function($id, Request $r) { return 'Event updated with '.$r->getContent(); }); – ● $app = new SilexApplication; $app->run(); http://silex.sensiolabs.org/
  • 6. Twig Template Engine ● Separation logic and view ● Frontend developers should not write PHP – ● Twig has own syntax for conditions, loops etc. Template: – – ● <h1>Event {{name}}</h1> {% if is_today %}<p>Happening today.</p>{% endif %} PHP Code: – – ● $twig = new Twig_Environment(new Twig_Loader_Filesystem('/views')); Return $twig->render('event.twig.html', array('name' => $event->getName(), 'is_today' => $event>getDate()==$now); http://twig.sensiolabs.org/
  • 7. Guzzle HTTP Library ● OOP abstraction layer for libcurl ● Extendable with plugins ● Service definitions for webservice API clients – ● Amazon WebServices PHP SDK Example: – – $client->setDefaultHeaders(array('Authorization' => 'Bearer '.$accessToken)); – $response = $client->get('/event/bcrm13')->send(); – ● $client = new GuzzleHttpClient('http://api.example.com/'); $eventData = $response->json(); http://guzzlephp.org/
  • 8. Doctrine Object-Relational-Mapper ● 1 SQL table = 1 PHP class – ● Mapping of fields and relations defined with annotations (comments) or in external configuration files Sample fields: – – /** @Column(type="string") **/ private $name; – ● /** @Id @Column(type="integer") **/ private $id; /** @OneToOne(targetEntity="User") **/ private $organizer; Creating Entity: – $event = new LukasRosenstockEventsBarCamp; – $em->persist($event); // em = EntityManager – $em->flush();
  • 9. Doctrine Object-Relational-Mapper ● Fetching Entity: – ● $event = $em>getRepository('LukasRosenstockEventsBarCamp')>findOneById(1); Modifying Entity: – – $event->setOrganizer($user); – ● $user = new LukasRosenstockEventsOrganizer; $em->flush(); http://www.doctrine-project.org/