{"id":2462,"date":"2024-09-17T15:50:22","date_gmt":"2024-09-17T14:50:22","guid":{"rendered":"https:\/\/codeflarelimited.com\/blog\/?p=2462"},"modified":"2024-09-19T10:53:24","modified_gmt":"2024-09-19T09:53:24","slug":"php-standard-recommendations","status":"publish","type":"post","link":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/","title":{"rendered":"Understanding the PSR Standards in PHP"},"content":{"rendered":"\n<p>PHP Standard Recommendations (PSRs) are a collection of guidelines developed by the PHP Framework Interoperability Group (PHP-FIG). These standards ensure consistency, readability, and maintainability in PHP code across different projects and frameworks. In this article, we will explore the most important PSR standards and their practical implications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. PSR-1: Basic Coding Standards<\/strong><\/h3>\n\n\n\n<p>PSR-1 lays down the foundational rules for PHP coding practices. It covers PHP tags, encoding, naming conventions, and class structure. The primary goal of PSR-1 is to ensure that code is interoperable between different frameworks and libraries.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Principles of PSR-1:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Files must use only <code>&lt;?php<\/code> and <code>&lt;?=<\/code> tags.<\/li>\n\n\n\n<li>Files must use UTF-8 encoding without a BOM (Byte Order Mark).<\/li>\n\n\n\n<li>Class names must follow the PascalCase convention.<\/li>\n\n\n\n<li>Constants must be declared in all uppercase with underscores separating words.<\/li>\n\n\n\n<li>Method names must be declared in camelCase.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nnamespace App\\Controllers;\n\nclass UserController\n{\n    public function getUser($id)\n    {\n        return \"User ID: \" . $id;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Here, we use <code>PascalCase<\/code> for the class name (<code>UserController<\/code>) and <code>camelCase<\/code> for method names (<code>getUser<\/code>), which follow PSR-1 guidelines.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. PSR-2: Coding Style Guide<\/strong><\/h3>\n\n\n\n<p>PSR-2 builds on PSR-1 and provides a detailed coding style guide. It ensures that all PHP code is written in a consistent format, making it easier for developers to read and maintain the code.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Guidelines of PSR-2:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use 4 spaces for indentation, no tabs.<\/li>\n\n\n\n<li>The opening brace for classes and methods must be on the next line.<\/li>\n\n\n\n<li>Control structures like <code>if<\/code>, <code>else<\/code>, and <code>while<\/code> should have braces on the same line.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nclass Calculator\n{\n    public function add($a, $b)\n    {\n        if ($a === 0) {\n            return $b;\n        } else {\n            return $a + $b;\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Notice the 4-space indentation, and how the opening brace for the method appears on the next line, adhering to PSR-2 standards.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. PSR-3: Logger Interface<\/strong><\/h3>\n\n\n\n<p>PSR-3 standardizes a logging interface that allows developers to log messages in a consistent way. The advantage of PSR-3 is that it abstracts the logging logic, allowing developers to switch between different logging libraries without rewriting code.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Methods of PSR-3:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>debug()<\/code>: Logs detailed debug information.<\/li>\n\n\n\n<li><code>info()<\/code>: Logs informational messages.<\/li>\n\n\n\n<li><code>notice()<\/code>: Logs normal but significant events.<\/li>\n\n\n\n<li><code>error()<\/code>: Logs runtime errors that do not require immediate action.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nuse Psr\\Log\\LoggerInterface;\n\nclass OrderController\n{\n    private $logger;\n\n    public function __construct(LoggerInterface $logger)\n    {\n        $this-&gt;logger = $logger;\n    }\n\n    public function placeOrder($orderId)\n    {\n        $this-&gt;logger-&gt;info('Placing order with ID: ' . $orderId);\n        \/\/ Code to place the order\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, the logger is passed to the controller, allowing the <code>info()<\/code> method to log the order placement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. PSR-4: Autoloading Standard<\/strong><\/h3>\n\n\n\n<p>PSR-4 defines a way to automatically load classes from the file system, avoiding the need to manually include files. The file paths must map to namespaces, allowing easy loading of classes based on their names.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Rules of PSR-4:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Namespace prefixes must match the file directory structure.<\/li>\n\n\n\n<li>The class name must map to a file path relative to the namespace.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/ Directory: src\/Controllers\/ProductController.php\n\nnamespace App\\Controllers;\n\nclass ProductController\n{\n    public function showProducts()\n    {\n        echo \"Showing products\";\n    }\n}\n\n\/\/ In composer.json:\n\"autoload\": {\n    \"psr-4\": {\n        \"App\\\\\": \"src\/\"\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>This PSR-4 autoloads the <code>ProductController<\/code> class when it is called, mapping the <code>App\\Controllers<\/code> namespace to the <code>src\/Controllers\/<\/code> directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. PSR-7: HTTP Message Interface<\/strong><\/h3>\n\n\n\n<p>PSR-7 defines common interfaces for working with HTTP requests and responses. It provides a consistent way to handle HTTP interactions between the client and the server, making it easier to integrate different libraries or frameworks.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key PSR-7 Interfaces:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>RequestInterface<\/code>: Handles the HTTP request.<\/li>\n\n\n\n<li><code>ResponseInterface<\/code>: Handles the HTTP response.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\n\nclass ApiController\n{\n    public function getResponse(ServerRequestInterface $request, ResponseInterface $response)\n    {\n        $response-&gt;getBody()-&gt;write('Hello, World!');\n        return $response;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, PSR-7 handles the HTTP request and modifies the response body with a message.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. PSR-12: Extended Coding Style Guide<\/strong><\/h3>\n\n\n\n<p>PSR-12 expands on PSR-2, focusing on more modern PHP features and stricter coding practices, including typing, visibility declarations, and more.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Guidelines of PSR-12:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <code>declare(strict_types=1);<\/code> to enforce strict typing.<\/li>\n\n\n\n<li>All properties must have visibility declared (<code>public<\/code>, <code>private<\/code>, <code>protected<\/code>).<\/li>\n\n\n\n<li>Split long class chains into multiple lines for better readability.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\ndeclare(strict_types=1);\n\nclass Order\n{\n    private int $orderId;\n    private string $orderName;\n\n    public function __construct(int $orderId, string $orderName)\n    {\n        $this-&gt;orderId = $orderId;\n        $this-&gt;orderName = $orderName;\n    }\n\n    public function getOrderName(): string\n    {\n        return $this-&gt;orderName;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Here, we use <code>strict_types<\/code> and declare visibility on all class properties, following PSR-12 guidelines.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>PHP Standard Recommendations (PSRs) are essential for writing maintainable, scalable, and consistent PHP code. By adhering to these standards, you ensure that your code follows best practices and is easily interoperable with other frameworks and libraries. Whether you&#8217;re working on autoloading classes with PSR-4 or logging with PSR-3, these guidelines are indispensable for modern PHP development.<\/p>\n\n\n\n<p><a href=\"https:\/\/codeflarelimited.com\/blog\/qr-code-generator-with-html-css-javascript\/\">How to Create a QR Generator using HTML, CSS, and JavaScript<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP Standard Recommendations (PSRs) are a collection of guidelines developed by the PHP Framework Interoperability Group (PHP-FIG). These<\/p>\n","protected":false},"author":3,"featured_media":2470,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[87],"tags":[99],"class_list":["post-2462","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-software-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP Standard Recommendations<\/title>\n<meta name=\"description\" content=\"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP Standard Recommendations\" \/>\n<meta property=\"og:description\" content=\"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-17T14:50:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-19T09:53:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1120\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Kene Samuel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/\"},\"author\":{\"name\":\"Kene Samuel\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\"},\"headline\":\"Understanding the PSR Standards in PHP\",\"datePublished\":\"2024-09-17T14:50:22+00:00\",\"dateModified\":\"2024-09-19T09:53:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/\"},\"wordCount\":612,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240918-WA0004.jpg\",\"keywords\":[\"software development\"],\"articleSection\":[\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/\",\"name\":\"PHP Standard Recommendations\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240918-WA0004.jpg\",\"datePublished\":\"2024-09-17T14:50:22+00:00\",\"dateModified\":\"2024-09-19T09:53:24+00:00\",\"description\":\"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#primaryimage\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240918-WA0004.jpg\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240918-WA0004.jpg\",\"width\":1120,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php-standard-recommendations\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"php\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Understanding the PSR Standards in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"name\":\"\",\"description\":\"Sustainable solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\",\"name\":\"Codeflare Limited\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"width\":1040,\"height\":263,\"caption\":\"Codeflare Limited\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\",\"name\":\"Kene Samuel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"caption\":\"Kene Samuel\"},\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/author\\\/kene\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP Standard Recommendations","description":"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/","og_locale":"en_US","og_type":"article","og_title":"PHP Standard Recommendations","og_description":"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.","og_url":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/","article_published_time":"2024-09-17T14:50:22+00:00","article_modified_time":"2024-09-19T09:53:24+00:00","og_image":[{"width":1120,"height":630,"url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","type":"image\/jpeg"}],"author":"Kene Samuel","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#article","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/"},"author":{"name":"Kene Samuel","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206"},"headline":"Understanding the PSR Standards in PHP","datePublished":"2024-09-17T14:50:22+00:00","dateModified":"2024-09-19T09:53:24+00:00","mainEntityOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/"},"wordCount":612,"commentCount":0,"publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","keywords":["software development"],"articleSection":["php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/","url":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/","name":"PHP Standard Recommendations","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#primaryimage"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","datePublished":"2024-09-17T14:50:22+00:00","dateModified":"2024-09-19T09:53:24+00:00","description":"Learn about PHP Standard Recommendations (PSR) to improve coding consistency and interoperability in PHP development.","breadcrumb":{"@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#primaryimage","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","width":1120,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/codeflarelimited.com\/blog\/php-standard-recommendations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codeflarelimited.com\/blog\/"},{"@type":"ListItem","position":2,"name":"php","item":"https:\/\/codeflarelimited.com\/blog\/php\/"},{"@type":"ListItem","position":3,"name":"Understanding the PSR Standards in PHP"}]},{"@type":"WebSite","@id":"https:\/\/codeflarelimited.com\/blog\/#website","url":"https:\/\/codeflarelimited.com\/blog\/","name":"","description":"Sustainable solutions","publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codeflarelimited.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codeflarelimited.com\/blog\/#organization","name":"Codeflare Limited","url":"https:\/\/codeflarelimited.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","width":1040,"height":263,"caption":"Codeflare Limited"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206","name":"Kene Samuel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","caption":"Kene Samuel"},"url":"https:\/\/codeflarelimited.com\/blog\/author\/kene\/"}]}},"jetpack_featured_media_url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240918-WA0004.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/comments?post=2462"}],"version-history":[{"count":1,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2462\/revisions"}],"predecessor-version":[{"id":2463,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2462\/revisions\/2463"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media\/2470"}],"wp:attachment":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media?parent=2462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/categories?post=2462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/tags?post=2462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}