PHP

From Things and Stuff Wiki
Revision as of 23:42, 7 October 2017 by Milk (talk | contribs) (→‎Testing)
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

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; 
  1. 55 to 53
 fastcgi_pass unix:/var/run/www53.fpm.socket;

}

Command-line

php -S localhost:8000
  • 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

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

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.

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

install;

wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear --version

or for shared hosts

pear install -o PEAR

PSR

Articles

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

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.

Assets

Performance

See also Server#Performance, HTTP#Performance

APC

Other

Process management

PHP & JS

VM

Future

Dialects