As the question, I am engaged in a little mixed, who can be careful to talk about: 1, composer psr-0 and psr-4 In the difference; 2, psr-0 specifications and psr-4 specifications of the
Title, I'm a little confused, who can say it carefully:
1, the difference between psr-0 and psr-4 in composer;
2, the difference between the psr-0 norm and the psr-4 norm;
3,
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
. For example, I can tell PHP that the classes, interfaces, and traits in the \ Feng \ YePHP namespace are in the src/directory of the physical file system, so that PHP can know, the classes, interfaces, and traits in the namespace prefixed with \ Feng \ YePHP correspond to directories and files in the src/directory.How to compile
Copy the above Code, paste it into your application, and then modify the values of the variable $ prefix and $ base_dir so that you can have an available
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: through the framework of the author or the representative of the framework of the discussion, with the minimum limi
First, Introduction
First of all, here to understand psr,proposing a standards recommendation (the standard recommendation) abbreviation, is a PHP development specification, let us develop the code more reasonable, better maintenance, more readable. There are several criteria for PSR:
PSR-0: Auto Load
PSR-1:
base directory.
Full class name
namespace Prefixes
File base directory
file path
\acme\log\writer\file_writer
Acme\log\writer
./acme-log-writer/lib/
./acme-log-writer/lib/file_writer.php
\aura\web\response\status
Aura\web
/path/to/aura-web/src/
/path/to/aura-web/src/response/status.php
\symfony\core\request
Symfony\core
./vendor/symfony/core/
./vendor/symfony/core/request.php
\zend
: This article mainly introduces the PSR-4 instance, for PHP tutorials interested in students can refer. Here is an example of implementing the PSR-4 specification:
Closure Example
Class Example
The following is an example of a class for processing multiple namespaces.
Register (); ** // register the base Dire
How should I understand the {code...} line of code in the loadClass () method in the implementation of the PSR-4 instance class? I think it should be: {code ...} the problem has been solved: see 'notice 'in the PHP operator priority Manual: although the priority is lower than that of most other operators, PHP still... implementation of PSR-
Swoole-1.8.1 has been released, add PSR-4 namespace class name swoole-1.8.1 version has been released, this version is a BUG fix version, mainly fix some bugs in version 1.8.0, in addition to version 1.8.1
Added the PSR-4 namespace style class name.
Namespace example:
To use the namespace class style, modify php. ini
In the PSR-4 instance class implementation
loadClass()Method in the
How should this line of code be understood?
I think it should be:
while (false !== ($pos = strrpos($prefix, '\\')))
The problem has been resolved:See ' Notice ' in the PHP operator precedence manual: although = lower precedence than most other operators, PHP still allows expressions similar to the following: if (! $a = foo ()), in t
Installation Project Dependencies
Next article composer Getting Started tutorial – Write a Composer.json file written in the Composer.json file (3) and execute the following command under the directory command line where the Composer.json file is located:
installinstall
The following files are successful when the installation project depends on success:Where the Packages folder holds the project's dependent libraries,
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.