Table of Contents
What are the contents of PHP’s PSR series of specifications? What are the contents of phppsr specifications?
PSR
PSR-0(Autoloading Standard)
PSR-1(Basic Coding Standard)
PSR-2(Coding Style Guide)
PSR-3(Logger Interface)
PSR-4(Improved Autoloading)
Home Backend Development PHP Tutorial What are the contents of PHP's PSR series of specifications? What are the phppsr specifications?_PHP Tutorial

What are the contents of PHP's PSR series of specifications? What are the phppsr specifications?_PHP Tutorial

Jul 13, 2016 am 10:09 AM
pdf file

What are the contents of PHP’s PSR series of specifications? What are the contents of phppsr specifications?

PSR

is the abbreviation of PHP Standard Recommendation. It should actually be called PSRs, which is a series of recommended standards: currently passed specifications include PSR-0 (Autoloading Standard), PSR-1 (Basic Coding Standard), PSR-2 (Coding Style Guide) ), PSR-3 (Logger Interface), PSR-4 (Improved Autoloading). It is not an official PHP standard, but a series of standards extracted from well-known PHP projects such as Zend and Symfony2. Currently, more and more community projects have joined as members and follow this standard.

PHP-FIG — PHP Framework Interoperability Group, is an organization that formulates PSRs development specifications. Its members are composed of many well-known PHP community projects. You can see the member list at the bottom of its official website homepage. These members develop specifications and implement them in their projects.

In fact, the content of each PSR specification is very concise and clear, which is much better than those specifications that span dozens of pages.

PSR-0(Autoloading Standard)

PSR-0 is the automatic class loading specification (original text: official website, GitHub). As of 2014-10-21, this specification is marked Deprecated and replaced by PSR-4. Its content is very concise.

Content:

PSR-1(Basic Coding Standard)

PSR-1 is the basic coding standard (original text: official website, GitHub). Is the content concise, including the naming method of class files, class names, and class method names?

Content:

PSR-2(Coding Style Guide)

PSR-2 is the coding style standard (original text: official website, GitHub). The content is slightly more, but it is still relatively concise. It is based on PSR-1 and includes relevant provisions for indentation, length of each line of code, line breaks, method visibility declarations, spaces, and method body brace wrapping.

Standard content:

PSR-3(Logger Interface)

PSR-3 is the definition of application log class through interface (original text: official website, GitHub). The content is very simple, it is just an interface. Just quote the official sample code. Of course, in specific applications, as long as you follow this interface, you can definitely customize the corresponding implementation.

Basic content:

PSR-4(Improved Autoloading)

PSR-4 is an improved version of the automatic loading specification (original text: official website, GitHub). It is the successor to the PSR-0 specification. It is compatible with any other autoloading specification, including PSR-0.

Content:

  • When loading a file from a fully qualified class name:
  • The implementation of the autoloader must not throw any exceptions or cause errors of any level; nor should it return a value

  • Note: The specific specification content is compiled with reference to other Chinese translation versions.

    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/947048.htmlTechArticleWhat are the contents of PHP’s PSR series specifications? What are the contents of phppsr specifications? PSR is the abbreviation of PHP Standard Recommendation. It is actually It should be called PSRs, that is, a series of recommended standards: the currently adopted specifications include PSR...
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Use Python and WebDriver to capture web pages and save them as PDF files Use Python and WebDriver to capture web pages and save them as PDF files Jul 08, 2023 pm 10:55 PM

    Use Python and WebDriver to screenshot web pages and save them as PDF files Summary: During web development and testing, it is often necessary to screenshot web pages for analysis, recording, and reporting. This article will introduce how to use Python and WebDriver to take screenshots of web pages and save the screenshots as PDF files for easy sharing and archiving. 1. Install and configure SeleniumWebDriver: Install Python: Visit the Python official website (https:

    How to convert html files into pdf files How to convert html files into pdf files Apr 02, 2024 pm 02:02 PM

    Conversion method: 1. Online conversion tools, such as pdfcrowd and online2pdf, can quickly convert HTML files to PDF without installation. 2. Browser plug-ins, such as Chrome's HTML to PDF plug-in, allow conversion to be performed directly in the browser. 3. Professional software, such as Adobe Acrobat and Foxit PhantomPDF, provide more comprehensive functions and support fast batch conversion and advanced output options.

    How to generate PDF files using PHP How to generate PDF files using PHP May 11, 2023 pm 03:55 PM

    In the application of modern Internet technology, PDF files are widely used as a cross-platform standard document format. As one of the most popular server-side programming languages, PHP is also very practical for processing PDF files. This article will introduce how to use PHP to generate PDF files. 1. Installing relevant extensions to generate PDF files requires the use of the PDF library, which can be achieved by installing PDF-related extensions. Commonly used PDF extensions include the following: TCPDF extension TCPDF is a tool used to generate P

    How to annotate PDF files in Edge browser? How to annotate PDF files in Edge browser? Mar 14, 2024 pm 04:00 PM

    How to annotate PDF files in Edge browser? This browser has this function, but many people don’t know where the annotation function is or how to use it. We can directly select the PDF opening method, and then we will enter the annotation interface. In order to facilitate the operation of the majority of users, today’s software tutorial content is Come and share the operation steps with the majority of users. Friends who are interested can follow the editor's steps to learn about it. Introduction to the method of annotating PDF files in Edge browser: 1. Select the PDF file that needs to be annotated, right-click and select the "Microsoft Edge" option in "Open with". 2. In the opened interface, click above

    How to use the time function in Go language to generate a schedule calendar and export it to a PDF file? How to use the time function in Go language to generate a schedule calendar and export it to a PDF file? Jul 30, 2023 pm 09:11 PM

    How to use the time function in Go language to generate a schedule calendar and export it to a PDF file? In daily life and work, we often need to arrange and manage schedules, and an important task is to generate a schedule calendar. As a concise and efficient programming language, Go language provides a wealth of time functions that can easily operate date and time. This article will introduce how to use the time function in the Go language to generate a schedule calendar and export it to a PDF file. First, we need to create a schedule calendar data structure. Let's say our schedule calendar package

    After opening the PDF file, the solution tutorial for digital out-of-bounds always pops up. After opening the PDF file, the solution tutorial for digital out-of-bounds always pops up. Jul 13, 2023 pm 01:33 PM

    PDF is one of the electronic document formats that people often use. Due to its good printing quality, no distortion, and easy portability, it is deeply loved by users, but it often encounters some problems during use. Users of the Win7 flagship system said that after opening a PDF file, a number out-of-bounds prompt always pops up, which is very annoying. how to solve this problem? Follow the small edge and look down. After opening a PDF file, a digital out-of-bounds error message always pops up. The solution may be that your PDF file is damaged, or the PDF software may be damaged. Solution: You can uninstall the PDF software first and then reinstall it. Then open the PDF file. If the same file is still there, it means the PDF file is corrupted. Second, many PDF documents are originally text versions with pictures in them, which may be

    How to extract and analyze text from multiple PDF files with Python for NLP? How to extract and analyze text from multiple PDF files with Python for NLP? Sep 27, 2023 pm 05:45 PM

    How to extract and analyze text from multiple PDF files with Python for NLP? Abstract: With the advent of the big data era, natural language processing (NLP) has become one of the important means to solve massive text data. As a common document format, PDF contains rich text information, so how to extract and analyze text in PDF files has become a key task in the field of NLP. This article will introduce how to use the Python programming language and related NLP libraries to extract and analyze multiple PDF files.

    How to use Python for NLP to identify and process dates and times in PDF files? How to use Python for NLP to identify and process dates and times in PDF files? Sep 28, 2023 am 09:10 AM

    How to use Python for NLP to identify and process dates and times in PDF files? NLP (Natural Language Processing) is a widely used research field that involves many tasks, including text classification, named entity recognition, sentiment analysis, etc. In NLP, processing dates and times is an important task because a lot of text data contains information about dates and times. This article will introduce how to use Python for NLP to identify and process dates and times in PDF files, and provide specific

    See all articles