1. PSR-4 Specification: Automatic loading
Although it is noted in [Psr-4-meta] that PSR-4 is a supplement to the PSR-0 specification rather than a replacement, it has been written in [PSR-0] that PSR-0 was abandoned in 2014.10.21 and that the Psr-4
PHP psr-0 psr-4 autoloading composer
In the previous article, we introduced PSR-0 and autoload-related content. Following the PSR-0, the PHP autoloading specification, the PHP-FIG has introduced a PSR-4 called the improved autoloading specification.
The number of PHP components and frameworks is incredibly large. There are mega-frameworks like Symfony and Laravel, as well as miniature frameworks like Silex and slim. There are even traditional frameworks that have existed long before modern PHP
====================PSR-0 (Automatic loading specification)=======================The PSR-0 (autoloading standard) class auto-load specification, which is now obsolete (Deprecated), will be replaced by PSR-4.1. A fully qualified namespace and class
PSR Specification
PSR Specification
Introduction: PSR is a shorthand for PHP standard recommendations, PHP specifications developed by the PHP FIG organization, is the practice of PHP development standards. The purpose of these specifications is to:
[PHP series] PHP recommended standard PSR-4, automatic loader policy, phppsr-4
The last time we talked about the PSR-3 logger interface, this time we're talking about the last standard of the SRS, The PSR-4, the auto loader policy.Reason
The
1. OverviewThis PSR describes a specification for autoloading classes from file paths. It is fully interoperable, and can being used in addition to any other autoloading specification, including PSR-0. This PSR also describes, where to place files,
Before using namespace for autoloading to introduce PSR-0, let's talk about NameSpace and Autoloading.
NameSpace)
Namespace is a new feature added to PHP5.3. it is used to solve the two problems encountered when you create reusable code such as
From 2014-10-21 onwards, the PSR-0 standard was marked as obsolete. It is recommended to use the PSR-4 standard as replacement.
The loader (autoloader) must comply with the requirements below.
Requirements:
A complete namespace or class
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.