PHP
Jump to navigation
Jump to search
General
- PHP Sadness - "These are things in PHP which make me sad. They are real, objective issues which I have personally encountered in my normal day-to-day activites. Nothing on this site should be taken to be the view of my employer or is related to my employer in any way."
Articles
- https://github.com/domnikl/DesignPatternsPHP - sample code for several design patterns in PHP
Configuration
Troubleshooting
ps auxww | grep php5-cgi #-- is the process running? netstat -an | grep 9000 # is the port open?
/fpm-status #enable
location = /fpm-status {
access_log off; allow 123.123.123.123; allow 127.0.0.1; deny all;
- 55 to 53
fastcgi_pass unix:/var/run/www53.fpm.socket;
}
Command-line
php -S localhost:8000
- https://github.com/jlogsdon/php-cli-tools - PHP Command Line Tools] - A collection of tools to help with command line development in PHP 5.3
- phpsh is an interactive shell for php that features readline history, tab completion, quick access to documentation. It was developed at Facebook and ironically, is written mostly in python. It is open source and released under a modified BSD license.
- Boris - A tiny little, but robust REPL for PHP
- PsySH - A runtime developer console, interactive debugger and REPL for PHP.
Code
echo() substr() — Return part of a string get_current_user()
function sasson_file_str_replace($file_path, $find, $replace) { $file_contents = file_get_contents($file_path); $file_contents = str_replace($find, $replace, $file_contents); file_put_contents($file_path, $file_contents); }
exec()
date
j/n/y 24/10/12 g:ia, j M 11:41pm, 13 Feb
curl
http
xml
Documentation
- phpDocumentor - Documentation Generator for PHP
Bugs, etc.
- PHPLint is a validator and documentator for PHP 4 and PHP 5 programs. PHPLint extends the PHP language through transparent meta-code that can drive the parser to a even more strict check of the source. PHPLint is not simply a checker: it implements a new, strong typed, language implemented over the PHP language.
- Xdebug's basic functions include the display of stack traces on error conditions, maximum nesting level protection and time tracking.
- Debugging PHP applications with xdebug
- Webgrind - Xdebug Profiling Web Frontend in PHP
Testing
Libraries
Extensions
PECL
- PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions. The packaging and distribution system used by PECL is shared with its sister, PEAR.
Other
Packages
PEAR
- PEAR is a framework and distribution system for reusable PHP components.
install;
wget http://pear.php.net/go-pear.phar php go-pear.phar pear --version
or for shared hosts
pear install -o PEAR
PSR
- PHP Framework Interoperability Group - Proposing a Standards Recommendation
Articles
- On PSR-0 Being Included In PHP's Core - November 3, 2011
- Packages: The Way Forward for PHP - Feb 2012
- Of PSR-0 and PHP: WordPress, TYPO3 and others
Composer
- Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs to install to run. Composer is not a package manager. It deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it will never install anything globally. Thus, it is a dependency manager. Strongly inspired by node's npm and ruby's bundler.
- Packagist is a Composer package repository. It lets you find packages and lets Composer know where to get the code from. You can use Composer to manage your project or libraries' dependencies - read more about it on the Composer website.
Etc.
- PHPCR - The PHP Content Repository is an adaption of the Java Content Repository (JCR) standard, an open API specification defined in JSR-283. The API defines how to handle hierarchical semi-structured data in a consistent way.
- The Doctrine Project is the home of a selected set of PHP libraries primarily focused on providing persistence services and related functionality. Its prize projects are a Object Relational Mapper and the Database Abstraction Layer it is built on top of. You can read more about the projects below or view a list of all projects.
Frameworks
Zend Framework
- Zend Framework is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase. Zend Framework is focused on building more secure, reliable, and modern Web 2.0 applications & web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo!, Flickr, as well as API providers and cataloguers like StrikeIron and ProgrammableWeb.
Symfony
- Symfony is a PHP framework. Symfony is a framework, a set of tools and a development methodology. Beyond the tools, Symfony is also a Philosophy and a Community.
- Symfony2 CMF
- https://github.com/symfony-cmf
- Installing and using Symfony2 with Composer
- KnpBundles - THE unofficial listing of Symfony2 bundles.
- http://fabien.potencier.org/article/65/why-symfony
- http://symfony.com/doc/2.0/book/from_flat_php_to_symfony2.html
Aura
- Aura provides independent library packages for PHP 5.4+. These packages can be used alone, in concert with each other, or combined into a full-stack framework of their own.
- Autoload: A PSR-0 compliant autoloader, ready for SplClassloader. Cli: Tools to build command-line controllers, including a CLI context, options management, and input/ouput handlers. Di: Dependency injection container. Framework: The only package that has dependencies, this package wraps the others to provide a component-based framework library. Tools to build HTTP response messages. Marshals data from any data source into domain objects, including relationships between those object. A web router. A signal slots / event handler implementation. SQL database connection and query tools. Template views, two-step views, and view helpers. Web.
Other
- CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks
- Kohana An elegant HMVC PHP5 framework that provides a rich set of components for building web applications. Fork of CodeIgniter.
- CakePHP makes building web applications simpler, faster and require less code. Use code generation and scaffolding features to rapidly build prototypes. No complicated XML or YAML files. Just setup your database and you're ready to bake. CakePHP is licensed under the MIT license which makes it perfect for use in commercial applications. The things you need are built-in. Translations, database access, caching, validation, authentication, and much more are all built into one of the original PHP MVC frameworks. Instead of having to plan where things go, CakePHP comes with a set of conventions to guide you in developing your application. CakePHP comes with built-in tools for input validation, CSRF protection, Form tampering protection, SQL injection prevention, and XSS prevention, helping you keep your application safe & secure.
- Yii is a high-performance PHP framework best for developing Web 2.0 applications. Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.
- Slim is a PHP 5 Micro Framework. What began as a weekend project is now a simple yet powerful PHP 5 framework to create RESTful web applications. The Slim micro framework is everything you need and nothing you don't.
- http://silex.sensiolabs.org/ - symfony2 based
Laravel
- Laravel - a web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Assets
Performance
See also Server#Performance, HTTP#Performance
- http://devbee.com/opcode_cache_for_dummies
- http://serverfault.com/questions/56148/which-php-opcode-cache-one-should-use-and-why
APC
- Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
Other
- http://stackoverflow.com/questions/28716/which-php-opcode-cacher-should-i-use-to-improve-performance
Process management
PHP & JS
VM
- http://coderoncode.com/2013/07/24/introduction-hhvm.html
- http://coderoncode.com/2013/07/27/first-steps-on-hhvm.html