Table des matières
PHP
Sources d'information :
- Les cours de Julien Pauli sur developpez.com sont très pertinents (sécurité, ZendFramework, …).
PHP8 Attributes
Compiler PHP et PECL pour Windows
Installer différentes versions de Php grâce au dépôt de Ondřej Surý (un développeur Debian) :
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update
Application Frameworks
InfoWorld review: Fabulous PHP frameworks, Zend Framework, Symfony, CodeIgniter, CakePHP, and other PHP frameworks conquer Web development with extensive features, powerful tools, and superior ease Review By Rick Grehan, InfoWorld, 2011-01-26.
The no-framework PHP MVC framework: Une petit leçon d'architecture PHP à lire absolument avant de commencer une petite application qui n'a pas les grandes ambitions d'un CMS.
Un code permettant de faire des benchmarks sur quelques framework: https://github.com/pmjones/php-framework-benchmarks par Paul M. Jones
PHP Component and Library API Design Overview by Ralph Schindler (2011-01-08)
Dans les plus connus
- Prado
- Laravel The PHP Framework For Web Artisans.
- eZComponents et maintenant en incubation par ASF Apache Zeta Components
Light MVC
Les “bons” frameworks c'est bien, mais quand on veut des performances pour un petit projet hébergé pour pas cher tout en ne ré-inventant pas la roue, il faudrait un framework léger.
- Kohana (a lightweight fork of CI (CodeIgniter)).
Dependency Injector
Un bon article de Fabien Potencier sur l'usage de l'injection de dépendance (en Php), notamment pour ceux qui ont du mal à voir l'utilité de l'IoC/DI.
Sur Wikipedia il y a toutes une liste de frameworks php qui implémentent le pattern Dependency Injection. Il faudrait jeter un oeil à tout ce petit monde: Dependency_injection.
- S2Container.PHP5: is a port of Java version Seasar2 to PHP5. C'est un DI à la Spring (def file, AOP aspect).
- Phemto is a dependency injector for PHP. Similar in concept to Pico container, but smaller. DI is for managing complex OO dependencies on a large project, e.g. for web frameworks, rather than the registry or service locator patterns.
- Yadif: Yet Another (PHP) Dependency Injection Framework. It is compatible with Zend Framework (ZF).
Un tout simple:
- Pimple par Fabien Potencier
Autres qui semblent tout neuf et sans communauté:
- Lion PHP Framework: objectifs impressionnants, mais tout jeune (communauté vide…).
Autres qui semblent inactifs ou pas finis:
Performance
Les generators “generator function” permettent d'économiser de la mémoire lors d'une itération. Au lieu d'accumuler dans un tableau
le résultat d'une fonction, avec yield
les valeurs sont retrournées au fil de l'itération.
Outillage
Liste d'outils/extension affectant le comportement de Php: Affecting PHP's Behaviour.
PHP_UML est un parser de code PHP, un générateur de XMI, et un outil de production de documentation. Concrètement, grâce à PHP_UML, vous pourrez importer dans un atelier de génie logiciel (comme Rationale Rose™ ou ArgoUml), une représentation UML d’une application PHP existante. Vous obtiendrez ainsi une vue d’ensemble du code, avec toutes les fonctions habituelles de votre AGL préféré.
Eclipse plugin: PHP Tool Integration (PTI)
AOP Aspect Oriented Programming avec Php
phpUnderControl
phpUnderControl - Continuous Integration for PHP.
- Testing and software metrics, PHPUnit output: Code Coverage, Project Mess Detection and Software Metrics.
- Documentation: PhpDocumentor, to generate an up to date documentation of the software on every build cycle. Therefore the developers will always get the latest API documentation of their project. Additionally phpUnderControl extracts the documentation violations found by the PhpDocumentor and visualizes these as an additional quality report in the user interface and the project time line of documentation violations.
- Coding Standards: With the package PHP_CodeSniffer
Phing
Phing: Le ANT (make like) pour Php.
Debug with Eclipse/PDT and Zend Debugger
Voir Eclipse PDT
config XDebug dans le php.ini :
zend_extension=/usr/lib64/php/modules/xdebug.so xdebug.remote_enable=On xdebug.remote_autostart=On xdebug.remote_handler=dbgp xdebug.remote_host=192.168.1.100 xdebug.remote_port=9000 xdebug.remote_mode=req
Alternative sans Eclipse: xdebugclient : http://code.google.com/p/xdebugclient/
FirePHP
FirePHP extends the aforementioned Firebug's capabilities to the server side, allowing you to easily log messages and other data hailing from a PHP script. This can be tremendously useful when debugging Ajax-driven features, or when you simply want to inspect the contents of an object or array without having to repeatedly insert and delete echo or var_dump statements. Like Firebug, FirePHP is also a Firefox extension. However you'll also need to install a simple PHP library on the server running your PHP-driven website. This script serves as the bridge for communications between the server and Firebug/FirePHP. Learn more at the official website, and be sure to check out the Developer.com article Firebug: Add Browser-based Debugging to Your Ajax Development.
SimpleTest
It is a PHP unit test and web test framework. Users of JUnit will be familiar with most of the interface. The JWebUnit style functionality is more complete now. It has support for SSL, forms, frames, proxies and basic authentication. The idea is that common but fiddly PHP tasks, such as logging into a site, can be tested easily.
PhpUnit
Features
- Complete port of JUnit 3.8.1 to PHP 5.
- Integrates ideas from TestNG, such as
- Annotation-based @grouping of test cases.
- Suite-Level setUp() and tearDown().
- Testing for failures.
- Supports Mock Objects (port of jMock).
- Supports database testing (port of DbUnit).
- Supports Code Coverage Analysis (utilizing the Xdebug extension for PHP) and can generate reports based on this information.
- Supports the calculation of software metrics.
- Can be used as a Project Mess Detector (PMD).
- Supports storing test result and code coverage data in a Test Database.
- Supports Incomplete Tests (port of junitour) and the skipping of tests.
- Supports Agile Documentation (port of TestDox).
- Supports generation of test code skeletons for existing code.
- Supports logging of test execution in an XML Format, as JavaScript Object Notation (JSON) messages, using the Test Anything Protocol (TAP), in GraphViz Markup, and to PEAR::Log sinks.
- Integrates with Selenium RC for web application user interface testing.
- Integrates with Apache Maven, Bamboo, Bitten, CruiseControl, and Parabuild for Continuous Integration.
- Integrates with Phing.
- “Self-Hosted” and Robust: PHPUnit is covered by a Test Suite that ensures it works correctly.
Voir:
- Développement piloté par les tests avec PHPUnit, Julien Pauli
- PHPUnit avancé : patterns de tests, Julien Pauli 16/07/2010
- Running PHPUnit tests in Eclipse PDT by Zdenek Machek, 22 August 2012
PHPDocumentor
For API documentation generation.
PHP_CodeSniffer
http://pear.php.net/package/PHP_CodeSniffer
PHP_CodeSniffer is a PHP5 script that tokenises and “sniffs” PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.
Librairies
Générale
SPL Standard Php Library
PHP5 possède un modèle objet 'non vide' : il est agrémenté de classes et d'interfaces internes, réunies dans ce qu'on appelle la SPL, ou Standard PHP Library. Nous allons voir en quoi ils peuvent s'avérer très utiles dans des développements orientés objets en PHP, de plus en plus nécéssaires de nos jours, afin de maintenir une cohérence logique dans ses programmes.
Intégrée : la SPL est en réalité une extension PHP, mais qui est très souvent (pour ne pas dire tout le temps) compilée dans PHP, quelle qu'en soit la distribution (Win, packages Linux…), ce qui donne l'impression de la nativité de ses fonctionnalités. La SPL rend beaucoup de services, et de plus en plus d'extensions PHP en sont dépendantes. Ainsi, à partir de PHP5.3, il ne sera plus possible de désactiver l'intégration de la SPL via la commande de compilation. Elle sera réellement “nativement” intégrée.
Outre une approche procédurale conservée, il est désormais possible avec PHP5 de développer des pages et des processus entièrement orientés objets. La SPL, ou Standard PHP Library, est un ensemble de classes disponibles, prêtes à être utilisées ou implémentées.
De nombreux patrons de conception (design pattern) sont fournis par la SPL.
Voir:
- Standard PHP Library (SPL) sur php.net
Date Time
Carbon a simple PHP API extension for DateTime.
Cron
crunz
https://github.com/lavary/crunz
- Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs) in PHP using a fluent API
- Install a cron job once and for all, manage the rest from the code
- Crunz is capable of executing any kind of executable command as well as PHP closures
Ce package semble bien géré et pérenne
Validation
Respect/Validation
For a Validation framework, look at http://respect.li/Validation/
owasp-php-filters
Office Excel/CSV
Spout
http://opensource.box.com/spout/
Spout supports 3 types of spreadsheets: XLSX, ODS and CSV. Spout provides a simple and unified API to read or create these different types of spreadsheets. Switching from one type to another is ridiculously easy!
PHPOffice
PhpSpreadsheet, PHPWord, PHPPresentation, PHPVisio, PhpProject
Graphique
PDF Parser
-
- Une lib très simpliste pour extrait des éléments d'un PDF. C'est une sur-couche simplifiant l'API de TCPDF
-
- is a standalone PHP package that provides various tools to extract data from PDF files.
mPDF
Très fort pour les langues (Ko, Th, Zh …)
TCPDF
TCPDF library is a FPDF “fork”
jpgraph
07 Oct 2010, JpGraph 3.5.0b1
artishow
15/12/2006 - Artichow 2.0.0 alpha et 1.1.0
Communication
WSO2 WSF/PHP
WSO2 Web Services Framework/PHP (WSO2 WSF/PHP)
The Web Services Framework for PHP is a PHP extension that delivers comprehensive WS-* based Web Services support for the PHP world. With WSF/PHP, your php applications can acquire enterprise grade web services capabilities and seamlessly integrate with other Java or .Net systems using web services.WSO2 WSF/PHP is an open source framework for providing/consuming Web services in PHP and is the only extension that supports the full Web services (WS*-) stack including security and reliable messaging.
In addition to the ability to provide and consume web services, WSF/PHP provides comprehensive support for REST based web services allowing you to expose your soap services as REST services. It also provides the data services capability. WSF/PHP comes with comprehensive documentation and samples in addition to tooling support in the form of a code generation tool which allows the PHP user to get started with PHP web services in no time. As WSF/PHP is based on WSF/C web services framework, it comes with proven interoperability with other major web services stacks including .Net and Java.
nusoap
wsdl-writer
xmlrpc-epi-php
Html & DOM scraper
Simple HTML DOM
php-html-parser
Goutte
Goutte is web crawling library for PHP. Goutte fourni un client programmable pour lire et interagir sur des pages html/xml.
http://github.com/fabpot/Goutte
// Require the Goutte phar file to use Goutte in a script: require_once '/path/to/goutte.phar'; // Create a Goutte Client instance: $client = new Client(); // Make requests $crawler = $client->request('GET', 'http://www.symfony-project.org/'); // Click on links: $link = $crawler->selectLink('Plugins')->link(); $crawler = $client->click($link); // Submit forms: $form = $crawler->selectButton('sign in')->form(); $crawler = $client->submit($form, array('signin[username]' => 'fabien', 'signin[password]' => 'xxxxxx')); //Extract data: $nodes = $crawler->filter('.error_list'); if ($nodes->count()) { die(sprintf("Authentification error: %s\n", $nodes->text())); } printf("Nb tasks: %d\n", $crawler->filter('#nb_tasks')->text());
Divers
eZComponents Workflow
http://ezcomponents.org/docs/tutorials/Workflow
The Workflow component provides a virtual machine that executes workflows represented through object graphs. These object graphs can be created programmatically through the software component's Workflow Definition API. Alternatively, a workflow definition can be loaded from an XML file. Object graph and XML file are two different representations of a workflow definition that uses a backend language built on the workflow patterns.
php_uploadprogress
Une extension PECL en C qui permet de suivre la progression d'un upload (An extension to track progress of a file upload).
http://pecl.php.net/package/uploadprogress
See http://cvs.php.net/viewvc.cgi/pecl/uploadprogress/examples/ for a little example.
It is only known to work on Apache with mod_php, other SAPI implementations unfortunately still have issues.
At least PHP 5.2 is needed.
Articles :
- Upload Progress Meter 1.0.1 released by Christian Stocker @ 29.06.2009
- Upload Progress Meter extension for PHP 5.2 by Christian Stocker @ 31.03.2009
- Upload Progress Meter - Common issues and some answers by Christian Stocker @ 31.03.2009
- Upload Progress Meter for Windows - The next take by Christian Stocker @ 13.03.2009
- Upload Progress Meter extension 0.9.2 released by Christian Stocker @ 22.01.2009
- Upload Progress Meter for Windows by Christian Stocker @ 06.12.2006
- Upload Progress Meter finally in PECL by Christian Stocker @ 05.12.2006
Templates engines
Blade
Used in Laravel https://laravel.com/docs/blade
Twig
Encore une belle réalisation de Fabien Potencier/Sensios Labs.
Doc:
- Google Groups:
tips
Show all variables
Set the environment debug mode to true:
$twig = new Twig_Environment($loader, array('debug' => true));
Add this in your template file:
{% debug %}
Happy debugging!
removed the debug tag (should be done in an extension) It's now available in the Twig-Extensions repository: http://github.com/fabpot/Twig-extensions
Smarty
- Gestion des variables : {$title}
- Gestion des zones : {Section name=Zone}
- Last release:
Php::TAL
http://phptal.org (http://phptal.sourceforge.net, http://phptal.motion-twin.com)
PHPTAL is a templating engine for PHP5 that implements brilliant Zope Page Templates syntax:
<div class="item" tal:repeat="item itemsArray"> <span tal:condition="item/hasDate" tal:replace="item/getDate"/> <a href="${item/getUrl}" tal:content="item/getTitle"/> <p tal:content="value/getContent"/> </div>
- Last release: PHPTAL 1.1.16 Released 2009-02-24
PHPTAL is fast thanks to compiled templates and fine-grained caching. Makes it easy to generate well-formed XML/XHTML (protected against XSS attacks). PHPTAL's code is mature and improving. Released free under LGPL license.
PHPTAL is a PHP implementation of ZPT work. To be short, PHPTAL is a XML/XHTML template library for PHP.
While most web developpers continue to use ASP/JSP/PHP tags as the core language of their templates, the Zope community came with a refreshing idea named TAL. The idea was to move presentation actions inside XHTML attributes instead of using plain tags or elements.
ModeliXe
- Gestion des variables : <mx:text id=“Variable” />
- Gestion des zones : <mx:bloc id=“Zone”>
- Last release:
BdD, DAL & ORM
Glossaire:
Pages:
ORM
- The Eloquent ORM included with Laravel Php Framework provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding “Model” which is used to interact with that table.
- Idiorm & Paris A minimalist database toolkit for PHP5
- RedBeanPHP Zero Config & Fluid Schema …
- dicaORM is a powerful and easy to use ORM library. It is based on the ActiveRecord pattern. It carries both data and behavior.
Database schema
DatabaseSchema de eZ Components permet de gérer un schéma de BdD: reverse/create to xml,php array,SQL DDL. Comparing Database Schemas. Validating Schemas.
Desktop tools
DBDesignerFork c'est pas du Php mais bien pratique pour designer. Last version 1.4 2007-07-31).
MySQL
MySQLnd Plugins: Writing a MySQL Query Logger in PHP with the help of the MySQLnd Userland Handler Extension (mysqlnd_uh) 2010-08-16
Other stuff
Streaming
- When using nginx you need to disable fastcgi_buffering with header('X-Accel-Buffering: no');
- Disabling the cache is useful to avoid caching the response header(“Cache-Control: no-cache, must-revalidate”);
Streaming Ajax response