From 6efdbe1767dd13f55badc04af7fb9e9a5d31e814 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 27 Jan 2023 20:18:15 +0100 Subject: [PATCH 01/20] Use jekyll-seo-tag plugin --- _config.yml | 12 ++++++++++++ _layouts/default.html | 14 ++++---------- _layouts/page.html | 14 ++++---------- index.html | 1 - 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/_config.yml b/_config.yml index 11e5662..ed5167d 100644 --- a/_config.yml +++ b/_config.yml @@ -18,6 +18,11 @@ defaults: path: "" values: sitemap: false + image: + path: /images/og-image.png + width: 1024 + height: 640 + alt: "PHP: The Right Way" # Excludes should be appended to the default # https://github.com/jekyll/jekyll/blob/master/lib/site_template/_config.yml#L37-L55 @@ -27,7 +32,9 @@ exclude: - gemfiles/ - Gemfile - Gemfile.lock + - Gruntfile.js - node_modules/ + - package.json - vendor/bundle/ - vendor/cache/ - vendor/gems/ @@ -39,3 +46,8 @@ exclude: - pages/example.md future: true + +title: "PHP: The Right Way" +tagline: Reference for PHP best practices +description: An easy-to-read, quick reference for PHP best practices, accepted coding standards, and links to authoritative PHP tutorials around the Web +logo: /images/og-image.png diff --git a/_layouts/default.html b/_layouts/default.html index 5a4619f..ad1fa9f 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -2,17 +2,11 @@ - {% if page.title %}{{ page.title }} - {% endif %}PHP: The Right Way - + + {% seo %} + - - - - - - - - + diff --git a/_layouts/page.html b/_layouts/page.html index 35cc108..b451a1d 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -2,17 +2,11 @@ - {% if page.title %}{{ page.title }} - {% endif %}PHP: The Right Way - + + {% seo %} + - - - - - - - - + diff --git a/index.html b/index.html index aaa39c0..783d636 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,5 @@ --- layout: default -description: "An easy-to-read, quick reference for PHP best practices, accepted coding standards, and links to authoritative PHP tutorials around the Web" sitemap: true --- From af68f8b16f1b36937576398418b1d4397e221eeb Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 24 Nov 2023 20:10:37 +0100 Subject: [PATCH 02/20] Update current PHP version to 8.3 --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 9 +++++---- _posts/01-04-01-Mac-Setup.md | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/_posts/01-02-01-Use-the-Current-Stable-Version.md b/_posts/01-02-01-Use-the-Current-Stable-Version.md index 7df7797..55277cf 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -1,14 +1,14 @@ --- -title: Use the Current Stable Version (8.2) +title: Use the Current Stable Version (8.3) isChild: true anchor: use_the_current_stable_version --- -## Use the Current Stable Version (8.2) {#use_the_current_stable_version_title} +## Use the Current Stable Version (8.3) {#use_the_current_stable_version_title} -If you are getting started with PHP, start with the current stable release of [PHP 8.2][php-release]. PHP 8.x adds many [new features](#language_highlights) over the older 7.x and 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. PHP 8 is a major update of the language and contains many new features and optimizations. +If you are getting started with PHP, start with the current stable release of [PHP 8.3][php-release]. PHP 8.x adds many [new features](#language_highlights) over the older 7.x and 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. PHP 8 is a major update of the language and contains many new features and optimizations. -You should try to upgrade to the latest stable version quickly - PHP 7.4 [is already End of Life][php-supported]. Upgrading is easy, as there are not many backwards compatibility breaks [PHP 8.0][php-bc-80], [PHP 8.1][php-bc-81], [PHP 8.2][php-bc-82]. If you are not sure which version a function or feature is in, you can check the PHP documentation on the [php.net][php-docs] website. +You should try to upgrade to the latest stable version quickly - PHP 7.4 [is already End of Life][php-supported]. Upgrading is easy, as there are not many backwards compatibility breaks [PHP 8.0][php-bc-80], [PHP 8.1][php-bc-81], [PHP 8.2][php-bc-82], [PHP 8.3][php-bc-83]. If you are not sure which version a function or feature is in, you can check the PHP documentation on the [php.net][php-docs] website. [php-release]: https://www.php.net/downloads.php [php-supported]: https://www.php.net/supported-versions.php @@ -16,3 +16,4 @@ You should try to upgrade to the latest stable version quickly - PHP 7.4 [is alr [php-bc-80]: https://www.php.net/manual/migration80.incompatible.php [php-bc-81]: https://www.php.net/manual/migration81.incompatible.php [php-bc-82]: https://www.php.net/manual/migration82.incompatible.php +[php-bc-83]: https://www.php.net/manual/migration83.incompatible.php diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index 5f10ab6..f8fe521 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -9,10 +9,10 @@ macOS comes prepackaged with PHP but it is normally a little behind the latest s ### Install PHP via Homebrew -[Homebrew] is a package manager for macOS that helps you easily install PHP and various extensions. The Homebrew core repository provides "formulae" for PHP 7.4, 8.0, 8.1 and PHP 8.2. Install the latest version with this command: +[Homebrew] is a package manager for macOS that helps you easily install PHP and various extensions. The Homebrew core repository provides "formulae" for PHP 7.4, 8.0, 8.1, 8.2 and PHP 8.3. Install the latest version with this command: ``` -brew install php@8.2 +brew install php@8.3 ``` You can switch between Homebrew PHP versions by modifying your `PATH` variable. Alternatively, you can use [brew-php-switcher][brew-php-switcher] to switch PHP versions automatically. @@ -21,12 +21,12 @@ You can also switch between PHP versions manually by unlinking and linking the w ``` brew unlink php -brew link --overwrite php@8.1 +brew link --overwrite php@8.2 ``` ``` brew unlink php -brew link --overwrite php@8.2 +brew link --overwrite php@8.3 ``` ### Install PHP via Macports @@ -40,14 +40,14 @@ MacPorts supports pre-compiled binaries, so you don't need to recompile every dependency from the source tarball files, it saves your life if you don't have any package installed on your system. -At this point, you can install `php54`, `php55`, `php56`, `php70`, `php71`, `php72`, `php73`, `php74`, `php80`, `php81` or `php82` using the `port install` command, for example: +At this point, you can install `php54`, `php55`, `php56`, `php70`, `php71`, `php72`, `php73`, `php74`, `php80`, `php81`, `php82` or `php83` using the `port install` command, for example: sudo port install php74 - sudo port install php82 + sudo port install php83 And you can run `select` command to switch your active PHP: - sudo port select --set php php82 + sudo port select --set php php83 ### Install PHP via phpbrew From af9090900b6216d30c984a832d88338d9a533ca7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 12 Feb 2024 14:52:13 +0100 Subject: [PATCH 03/20] Code Style Guide: update URL for PHP_CodeSniffer ... and small improvement to the text about running PHPCS in a git hook. _When this text was originally written, the `--filter=GitStaged` option didn't exist yet, but now it does, it seems like a good pointer to add to the text._ Ref: * https://github.com/squizlabs/PHP_CodeSniffer/issues/3932 (about the repo URL change) * https://github.com/squizlabs/PHP_CodeSniffer/pull/2137 (about the GitStaged filter) --- _posts/02-01-01-Code-Style-Guide.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 06f7c8f..b890309 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -39,8 +39,8 @@ And you can run phpcs manually from shell: phpcs -sw --standard=PSR1 file.php It will show errors and describe how to fix them. -It can also be helpful to include this command in a git hook. -That way, branches which contain violations against the chosen standard cannot enter the repository until those +It can also be helpful to include the `phpcs` command in a git pre-commit hook with the `--filter=GitStaged` CLI argument. +That way, code which contain violations against the chosen standard cannot enter the repository until those violations have been fixed. If you have PHP_CodeSniffer, then you can fix the code layout problems reported by it, automatically, with the @@ -65,8 +65,8 @@ Finally, a good supplementary resource for writing clean PHP code is [Clean Code [per-cs]: https://www.php-fig.org/per/coding-style/ [pear-cs]: https://pear.php.net/manual/en/standards.php [symfony-cs]: https://symfony.com/doc/current/contributing/code/standards.html -[phpcs]: https://github.com/squizlabs/PHP_CodeSniffer -[phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically +[phpcs]: https://github.com/PHPCSStandards/PHP_CodeSniffer +[phpcbf]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: https://cs.symfony.com/ [cleancode]: https://github.com/jupeter/clean-code-php From 124c1ca7cbe5abc8a173c4b45f95820f6e40cae1 Mon Sep 17 00:00:00 2001 From: Clarisse Deschamps <91066589+deschcla@users.noreply.github.com> Date: Thu, 14 Mar 2024 20:10:32 +0100 Subject: [PATCH 04/20] Update URL for Storyplayer in 11-02-01-Test-Driven-Development.md The current URL no longer exists. We can replace it with the URL of the GitHub repository. --- _posts/11-02-01-Test-Driven-Development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/11-02-01-Test-Driven-Development.md b/_posts/11-02-01-Test-Driven-Development.md index 95a8bea..8b81879 100644 --- a/_posts/11-02-01-Test-Driven-Development.md +++ b/_posts/11-02-01-Test-Driven-Development.md @@ -66,4 +66,4 @@ users of the application. * [Selenium](https://www.selenium.dev/) * [Mink](https://mink.behat.org/) * [Codeception](https://codeception.com/) is a full-stack testing framework that includes acceptance testing tools -* [Storyplayer](https://datasift.github.io/storyplayer/) is a full-stack testing framework that includes support for creating and destroying test environments on demand +* [Storyplayer](https://github.com/MeltwaterArchive/storyplayer) is a full-stack testing framework that includes support for creating and destroying test environments on demand From 01951ad1c9f30876a7bf2ba07fbd78676badcf01 Mon Sep 17 00:00:00 2001 From: Ahsan Moin Date: Thu, 28 Mar 2024 10:17:35 -0400 Subject: [PATCH 05/20] Update outdated PaaS Providers AppFog was acquired by Lumen IBM Cloud has updated their docs Jelastic was acquired by Virtuozzo Nanobox was replaced by DigitalOcean App Platform Pivotal Web Services has new link --- _posts/16-05-01-PHP-PaaS-Providers.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 4fee26c..c1fde41 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -6,19 +6,19 @@ anchor: php_paas_providers ## PHP PaaS Providers {#php_paas_providers_title} -* [AppFog](https://www.ctl.io/appfog/) * [Amezmo](https://www.amezmo.com) * [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) * [Cloudways](https://www.cloudways.com/) -* [Divio](https://www.divio.com/php/) +* [DigitalOcean App Platform](https://www.digitalocean.com/products/app-platform) +* [Divio](https://www.divio.com/) * [Engine Yard Cloud](https://www.engineyard.com/) * [fortrabbit](https://www.fortrabbit.com/) * [Google App Engine](https://cloud.google.com/appengine/docs/php/) * [Heroku](https://devcenter.heroku.com/categories/php-support) -* [IBM Cloud](https://console.bluemix.net/docs/runtimes/php/getting-started.html#getting_started) -* [Jelastic](https://jelastic.com/) +* [IBM Cloud](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-prep#prep_php) +* [Lumen](https://www.lumen.com/) * [Microsoft Azure](https://azure.microsoft.com/) -* [Nanobox](https://nanobox.io/) -* [Pivotal Web Services](https://run.pivotal.io/) +* [Pivotal Web Services](https://network.pivotal.io/) * [Platform.sh](https://platform.sh/) * [Red Hat OpenShift](https://www.openshift.com/) +* [Virtuozzo](https://www.virtuozzo.com/application-platform-partners/) From 40b5633c41124420b26767435a042929c6323cef Mon Sep 17 00:00:00 2001 From: Christian Leo-Pernold Date: Thu, 4 Apr 2024 12:04:13 +0200 Subject: [PATCH 06/20] Update README.md Remove the link to the German translation as it is no longer available. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0efa7ec..799701f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ You should read the `CONTRIBUTING.md` file for precise instructions and tips. Bu * [English](https://www.phptherightway.com) -* [Deutsch](https://rwetzlmayr.github.io/php-the-right-way) * [Español](https://phpdevenezuela.github.io/php-the-right-way) * [Français](https://eilgin.github.io/php-the-right-way/) * [Indonesia](https://id.phptherightway.com) From f14345efe80e565648391993109057abdd326e70 Mon Sep 17 00:00:00 2001 From: Christian Leo-Pernold Date: Thu, 4 Apr 2024 12:05:38 +0200 Subject: [PATCH 07/20] Update welcome.md Remove the link to the German translation as it is no longer available. --- _includes/welcome.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index e8b9b11..412989a 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -20,7 +20,6 @@ and examples as they become available. _PHP: The Right Way_ is translated into many different languages: * [English](https://www.phptherightway.com) -* [Deutsch](https://rwetzlmayr.github.io/php-the-right-way) * [Español](https://phpdevenezuela.github.io/php-the-right-way) * [Français](https://eilgin.github.io/php-the-right-way/) * [Indonesia](https://id.phptherightway.com) From bc9e2adaa92e97aeee46e25adf84d0d52f78e94e Mon Sep 17 00:00:00 2001 From: Rob George Date: Mon, 3 Jun 2024 12:13:14 +0100 Subject: [PATCH 08/20] Later macOS versions do not include PHP --- _posts/01-04-01-Mac-Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index f8fe521..3073a49 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -5,7 +5,7 @@ anchor: mac_setup ## macOS Setup {#mac_setup_title} -macOS comes prepackaged with PHP but it is normally a little behind the latest stable release. There are multiple ways to install the latest PHP version on macOS. +macOS 12 (Monterey) and later does not come prepackaged with PHP. Earlier macOS versions include PHP but are behind the latest stable release. There are multiple ways to install the latest PHP version on macOS. ### Install PHP via Homebrew From 12f59ff36a0a8d31758ebbd5580f1455cbd4cb7c Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sat, 28 Sep 2024 04:55:05 +0900 Subject: [PATCH 09/20] Precision on when APCu cache is shared or not The information is based on https://github.com/krakjoe/apcu/issues/121#issuecomment-136091336. The fact that PHP-FPM shares cache across all pools was verified in a real-world scenario. Fixes #1009 --- _posts/14-03-01-Object-Caching.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_posts/14-03-01-Object-Caching.md b/_posts/14-03-01-Object-Caching.md index 07155dc..694fa85 100644 --- a/_posts/14-03-01-Object-Caching.md +++ b/_posts/14-03-01-Object-Caching.md @@ -20,9 +20,11 @@ one real limitation of APCu is that it is tied to the server it's installed on. installed as a separate service and can be accessed across the network, meaning that you can store objects in a hyper-fast data store in a central location and many different systems can pull from it. -Note that when running PHP as a (Fast-)CGI application inside your webserver, every PHP process will have its own cache, -i.e. APCu data is not shared between your worker processes. In these cases, you might want to consider using memcached -instead, as it's not tied to the PHP processes. +Note that whether the cache is shared across PHP processes depends on how PHP is used. When running PHP via PHP-FPM, +the cache is shared across all processes of all pools. When running PHP as a (Fast-)CGI application inside your +webserver, the cache is not shared, i.e every PHP process will have its own APCu data. When running PHP as a command +line, the cache is not shared and will only exists for the duration of the command. So you have to be mindful of your +situation and goals. And you might want to consider using memcached instead, as it's not tied to the PHP processes. In a networked configuration APCu will usually outperform memcached in terms of access speed, but memcached will be able to scale up faster and further. If you do not expect to have multiple servers running your application, or do not From 78cff893e7ade029a2ba35eb5924bba2390832d8 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sat, 28 Sep 2024 18:31:08 +0200 Subject: [PATCH 10/20] Update _posts/14-03-01-Object-Caching.md Co-authored-by: Chris Brown --- _posts/14-03-01-Object-Caching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/14-03-01-Object-Caching.md b/_posts/14-03-01-Object-Caching.md index 694fa85..da883a3 100644 --- a/_posts/14-03-01-Object-Caching.md +++ b/_posts/14-03-01-Object-Caching.md @@ -23,7 +23,7 @@ hyper-fast data store in a central location and many different systems can pull Note that whether the cache is shared across PHP processes depends on how PHP is used. When running PHP via PHP-FPM, the cache is shared across all processes of all pools. When running PHP as a (Fast-)CGI application inside your webserver, the cache is not shared, i.e every PHP process will have its own APCu data. When running PHP as a command -line, the cache is not shared and will only exists for the duration of the command. So you have to be mindful of your +line, the cache is not shared and will only exist for the duration of the command. So you have to be mindful of your situation and goals. And you might want to consider using memcached instead, as it's not tied to the PHP processes. In a networked configuration APCu will usually outperform memcached in terms of access speed, but memcached will be From 30b6917042377cba0dcb11aaa0ed750ebd98c868 Mon Sep 17 00:00:00 2001 From: JasonnnW3000 Date: Tue, 31 Dec 2024 13:03:22 -0500 Subject: [PATCH 11/20] Update LICENSE, fix license year Signed-off-by: JasonnnW3000 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index c3a7010..99ae39a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,3 @@ -Copyright (c) 2013 Josh Lockhart +Copyright (c) 2025 Josh Lockhart https://creativecommons.org/licenses/by-nc-sa/3.0/ From a3c3be7e1850cac1389c26981d880a760841c128 Mon Sep 17 00:00:00 2001 From: Xymph Date: Fri, 3 Jan 2025 17:26:36 +0100 Subject: [PATCH 12/20] Fix PHPDoc links --- _posts/15-02-01-PHPDoc.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_posts/15-02-01-PHPDoc.md b/_posts/15-02-01-PHPDoc.md index 49c3a46..415abc0 100644 --- a/_posts/15-02-01-PHPDoc.md +++ b/_posts/15-02-01-PHPDoc.md @@ -15,7 +15,7 @@ Below is an example of how you might document a class with a few methods; - * @link https://www.phpdoc.org/docs/latest/index.html + * @link https://docs.phpdoc.org/ */ class DateTimeHelper { @@ -70,10 +70,10 @@ difference between the second and third methods' doc block is the inclusion/excl `@return void` explicitly informs us that there is no return; historically omitting the `@return void` statement also results in the same (no return) action. -[tags]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/index.html -[PHPDoc manual]: https://docs.phpdoc.org/latest/index.html -[@author]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/author.html -[@link]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/link.html -[@param]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/param.html -[@return]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/return.html -[@throws]: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/throws.html +[tags]: https://docs.phpdoc.org/guide/references/phpdoc/tags/ +[PHPDoc manual]: https://docs.phpdoc.org/ +[@author]: https://docs.phpdoc.org/guide/references/phpdoc/tags/author.html +[@link]: https://docs.phpdoc.org/guide/references/phpdoc/tags/link.html +[@param]: https://docs.phpdoc.org/guide/references/phpdoc/tags/param.html +[@return]: https://docs.phpdoc.org/guide/references/phpdoc/tags/return.html +[@throws]: https://docs.phpdoc.org/guide/references/phpdoc/tags/throws.html From 485714543d20e63a32b7ca5b69f83c06e0e82266 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Fri, 3 Jan 2025 23:20:10 +0000 Subject: [PATCH 13/20] Add Cypress.io to section of links to tools for end-to-end testing --- _posts/11-02-01-Test-Driven-Development.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_posts/11-02-01-Test-Driven-Development.md b/_posts/11-02-01-Test-Driven-Development.md index 8b81879..25b4230 100644 --- a/_posts/11-02-01-Test-Driven-Development.md +++ b/_posts/11-02-01-Test-Driven-Development.md @@ -63,7 +63,8 @@ users of the application. #### Functional Testing Tools -* [Selenium](https://www.selenium.dev/) -* [Mink](https://mink.behat.org/) * [Codeception](https://codeception.com/) is a full-stack testing framework that includes acceptance testing tools +* [Cyress](https://www.cypress.io/) +* [Mink](https://mink.behat.org/) +* [Selenium](https://www.selenium.dev/) * [Storyplayer](https://github.com/MeltwaterArchive/storyplayer) is a full-stack testing framework that includes support for creating and destroying test environments on demand From b2b13ef5cdbfbf5053ad6a403a51ca435d3749a7 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Fri, 3 Jan 2025 23:26:09 +0000 Subject: [PATCH 14/20] Fix typo (maintened -> maintained) --- _posts/01-06-01-Linux-Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/01-06-01-Linux-Setup.md b/_posts/01-06-01-Linux-Setup.md index aac6b73..cd0eadc 100644 --- a/_posts/01-06-01-Linux-Setup.md +++ b/_posts/01-06-01-Linux-Setup.md @@ -5,7 +5,7 @@ anchor: linux_setup ## Linux Setup {#linux_setup_title} -Most GNU/Linux distributions come with PHP available from the official repositories, but those packages usually are a little behind the current stable version. There are multiple ways to get newer PHP versions on such distributions. On Ubuntu and Debian-based GNU/Linux distributions, for instance, the best alternatives for native packages are provided and maintened by [Ondřej Surý][Ondrej Sury Blog], through his Personal Package Archive (PPA) on Ubuntu and DPA/bikeshed on Debian. Find instructions for each of these below. All that said, you can always use containers, compile the PHP Source code, etc. +Most GNU/Linux distributions come with PHP available from the official repositories, but those packages usually are a little behind the current stable version. There are multiple ways to get newer PHP versions on such distributions. On Ubuntu and Debian-based GNU/Linux distributions, for instance, the best alternatives for native packages are provided and maintained by [Ondřej Surý][Ondrej Sury Blog], through his Personal Package Archive (PPA) on Ubuntu and DPA/bikeshed on Debian. Find instructions for each of these below. All that said, you can always use containers, compile the PHP Source code, etc. ### Ubuntu-based distributions From afbe01793cd5ff103806ce45165b0b40c1eaed04 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Fri, 3 Jan 2025 23:39:16 +0000 Subject: [PATCH 15/20] Rephrase Object Caching section a little, improve phrasing/grammar --- _posts/14-03-01-Object-Caching.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/_posts/14-03-01-Object-Caching.md b/_posts/14-03-01-Object-Caching.md index da883a3..714df62 100644 --- a/_posts/14-03-01-Object-Caching.md +++ b/_posts/14-03-01-Object-Caching.md @@ -22,9 +22,9 @@ hyper-fast data store in a central location and many different systems can pull Note that whether the cache is shared across PHP processes depends on how PHP is used. When running PHP via PHP-FPM, the cache is shared across all processes of all pools. When running PHP as a (Fast-)CGI application inside your -webserver, the cache is not shared, i.e every PHP process will have its own APCu data. When running PHP as a command -line, the cache is not shared and will only exist for the duration of the command. So you have to be mindful of your -situation and goals. And you might want to consider using memcached instead, as it's not tied to the PHP processes. +webserver, the cache is not shared, i.e every PHP process will have its own APCu data. When running PHP on the command +line, the cache is not shared and will only exist for the duration of the command, so you have to be mindful of your +situation and goals. You might want to consider using memcached instead, as it's not tied to the PHP processes. In a networked configuration APCu will usually outperform memcached in terms of access speed, but memcached will be able to scale up faster and further. If you do not expect to have multiple servers running your application, or do not @@ -44,9 +44,6 @@ if ($data === false) { print_r($data); {% endhighlight %} -Note that prior to PHP 5.5, there was the APC extension which provided both an object cache and a bytecode cache. The new APCu is a project to bring APC's -object cache to PHP 5.5+, since PHP now has a built-in bytecode cache (OPcache). - ### Learn more about popular object caching systems: * [APCu](https://github.com/krakjoe/apcu) From bfa6633cb0bd04fd378b6e31475e24163512ea80 Mon Sep 17 00:00:00 2001 From: Andrej Rypo Date: Wed, 15 Jan 2025 13:32:04 +0100 Subject: [PATCH 16/20] PHP 8.4 - the current stable version 8.3 --> 8.4 --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_posts/01-02-01-Use-the-Current-Stable-Version.md b/_posts/01-02-01-Use-the-Current-Stable-Version.md index 55277cf..9047574 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -1,14 +1,14 @@ --- -title: Use the Current Stable Version (8.3) +title: Use the Current Stable Version (8.4) isChild: true anchor: use_the_current_stable_version --- -## Use the Current Stable Version (8.3) {#use_the_current_stable_version_title} +## Use the Current Stable Version (8.4) {#use_the_current_stable_version_title} -If you are getting started with PHP, start with the current stable release of [PHP 8.3][php-release]. PHP 8.x adds many [new features](#language_highlights) over the older 7.x and 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. PHP 8 is a major update of the language and contains many new features and optimizations. +If you are getting started with PHP, start with the current stable release of [PHP 8.4][php-release]. PHP 8.x adds many [new features](#language_highlights) over the older 7.x and 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. PHP 8 is a major update of the language and contains many new features and optimizations. -You should try to upgrade to the latest stable version quickly - PHP 7.4 [is already End of Life][php-supported]. Upgrading is easy, as there are not many backwards compatibility breaks [PHP 8.0][php-bc-80], [PHP 8.1][php-bc-81], [PHP 8.2][php-bc-82], [PHP 8.3][php-bc-83]. If you are not sure which version a function or feature is in, you can check the PHP documentation on the [php.net][php-docs] website. +You should try to upgrade to the latest stable version quickly - PHP 7.4 [is already End of Life][php-supported]. Upgrading is easy, as there are not many backwards compatibility breaks [PHP 8.0][php-bc-80], [PHP 8.1][php-bc-81], [PHP 8.2][php-bc-82], [PHP 8.3][php-bc-83], [PHP 8.4][php-bc-84]. If you are not sure which version a function or feature is in, you can check the PHP documentation on the [php.net][php-docs] website. [php-release]: https://www.php.net/downloads.php [php-supported]: https://www.php.net/supported-versions.php @@ -17,3 +17,4 @@ You should try to upgrade to the latest stable version quickly - PHP 7.4 [is alr [php-bc-81]: https://www.php.net/manual/migration81.incompatible.php [php-bc-82]: https://www.php.net/manual/migration82.incompatible.php [php-bc-83]: https://www.php.net/manual/migration83.incompatible.php +[php-bc-84]: https://www.php.net/manual/migration84.incompatible.php From c37e78c7250b579edd941aa98143b5981a5d2229 Mon Sep 17 00:00:00 2001 From: standard Date: Fri, 14 Feb 2025 10:43:24 +0100 Subject: [PATCH 17/20] Renamed twitter as x --- README.md | 2 +- _layouts/default.html | 2 +- _layouts/page.html | 2 +- _posts/16-03-01-People-to-Follow.md | 2 +- _posts/17-01-01-Community.md | 4 ++-- _posts/17-02-01-User-Groups.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 799701f..5c47a2b 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ There's been a lot of discussion lately about how the PHP community lacks suffic ## Who -My name is [Josh Lockhart](https://twitter.com/codeguy). I'm the author of the [Slim Framework](https://www.slimframework.com/), and I work for [New Media Campaigns](https://www.newmediacampaigns.com/). +My name is [Josh Lockhart](https://x.com/codeguy). I'm the author of the [Slim Framework](https://www.slimframework.com/), and I work for [New Media Campaigns](https://www.newmediacampaigns.com/). ### Collaborators diff --git a/_layouts/default.html b/_layouts/default.html index 5a4619f..8b5bc02 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -25,7 +25,7 @@

PHP The Right Way

Last Updated: {{ site.time }}
diff --git a/_layouts/page.html b/_layouts/page.html index 35cc108..5bd78cd 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -25,7 +25,7 @@

PHP The Right Way

Last Updated: {{ site.time }}
diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index b96c6bf..b82565f 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -11,4 +11,4 @@ community members when you are first starting out. You can find an abbreviated list of PHP community members to get you started at: * -* +* diff --git a/_posts/17-01-01-Community.md b/_posts/17-01-01-Community.md index c574e54..89c8d0e 100644 --- a/_posts/17-01-01-Community.md +++ b/_posts/17-01-01-Community.md @@ -7,14 +7,14 @@ anchor: community The PHP community is as diverse as it is large, and its members are ready and willing to support new PHP programmers. Consider joining your local PHP user group (PUG) or attending larger PHP conferences to learn more about the best practices shown here. You can hang out on IRC in the #phpc channel on [irc.freenode.com][php-irc] and follow the -@phpc on [Twitter][phpc-twitter] or [Mastodon][phpc-mastodon]. Get out there, meet new developers, learn new topics, and above all, make new +@phpc on [X][phpc-x] or [Mastodon][phpc-mastodon]. Get out there, meet new developers, learn new topics, and above all, make new friends! Other community resources include [StackOverflow][php-so]. [Read the Official PHP Events Calendar][php-calendar] [php-irc]: https://webchat.freenode.net/?channels=phpc -[phpc-twitter]: https://twitter.com/phpc +[phpc-x]: https://x.com/phpc [phpc-mastodon]: https://phpc.social/ [php-so]: https://stackoverflow.com/questions/tagged/php [php-calendar]: https://www.php.net/cal.php diff --git a/_posts/17-02-01-User-Groups.md b/_posts/17-02-01-User-Groups.md index 16beb08..89d8d76 100644 --- a/_posts/17-02-01-User-Groups.md +++ b/_posts/17-02-01-User-Groups.md @@ -22,5 +22,5 @@ generally promote the creating of a "female friendly" and professional atmospher [meetup]: https://www.meetup.com/find/ [php-ug]: https://php.ug/ [NomadPHP]: https://nomadphp.com/ -[PHPWomen]: https://twitter.com/PHPWomen +[PHPWomen]: https://x.com/PHPWomen [php-wiki]: https://wiki.php.net/usergroups From 1118fc8cd2b5739d752bdca176d5c178c1c4d581 Mon Sep 17 00:00:00 2001 From: Raph Date: Sun, 2 Mar 2025 22:25:04 +0100 Subject: [PATCH 18/20] Remove "until recently" phrase regarding dependency management Composer is 13 years old. --- _posts/04-01-01-Dependency-Management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/04-01-01-Dependency-Management.md b/_posts/04-01-01-Dependency-Management.md index 8b55043..ed0fe9d 100644 --- a/_posts/04-01-01-Dependency-Management.md +++ b/_posts/04-01-01-Dependency-Management.md @@ -5,7 +5,7 @@ anchor: dependency_management # Dependency Management {#dependency_management_title} There are a ton of PHP libraries, frameworks, and components to choose from. Your project will likely use -several of them — these are project dependencies. Until recently, PHP did not have a good way to manage +several of them — these are project dependencies. PHP did not have a good way to manage these project dependencies. Even if you managed them manually, you still had to worry about autoloaders. That is no longer an issue. From c756fca67d99fd8f53cdbf40ebc79cc3178db43c Mon Sep 17 00:00:00 2001 From: AllenJB Date: Sun, 16 Mar 2025 08:36:30 +0000 Subject: [PATCH 19/20] Update chat links to point to Libera and Discord --- _posts/17-01-01-Community.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_posts/17-01-01-Community.md b/_posts/17-01-01-Community.md index 89c8d0e..cb12a68 100644 --- a/_posts/17-01-01-Community.md +++ b/_posts/17-01-01-Community.md @@ -6,14 +6,15 @@ anchor: community The PHP community is as diverse as it is large, and its members are ready and willing to support new PHP programmers. Consider joining your local PHP user group (PUG) or attending larger PHP conferences to learn more about the best -practices shown here. You can hang out on IRC in the #phpc channel on [irc.freenode.com][php-irc] and follow the -@phpc on [X][phpc-x] or [Mastodon][phpc-mastodon]. Get out there, meet new developers, learn new topics, and above all, make new +practices shown here. You can hang out on IRC in the #phpc channel on [irc.libera.chat][php-irc] and follow the +@phpc, on [Discord][php-discord], on [X][phpc-x] or [Mastodon][phpc-mastodon]. Get out there, meet new developers, learn new topics, and above all, make new friends! Other community resources include [StackOverflow][php-so]. [Read the Official PHP Events Calendar][php-calendar] -[php-irc]: https://webchat.freenode.net/?channels=phpc +[php-irc]: https://web.libera.chat/#phpc +[php-discord]: https://phpc.chat/ [phpc-x]: https://x.com/phpc [phpc-mastodon]: https://phpc.social/ [php-so]: https://stackoverflow.com/questions/tagged/php From f6908ca71bb4259f3f7c9320ff3b26266af4f425 Mon Sep 17 00:00:00 2001 From: Josh Kautz Date: Tue, 15 Apr 2025 11:53:37 -0500 Subject: [PATCH 20/20] Update 01-04-01-Mac-Setup.md Updated instructions for using Homebrew to install PHP. --- _posts/01-04-01-Mac-Setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index 3073a49..06b6cc1 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -9,10 +9,10 @@ macOS 12 (Monterey) and later does not come prepackaged with PHP. Earlier macOS ### Install PHP via Homebrew -[Homebrew] is a package manager for macOS that helps you easily install PHP and various extensions. The Homebrew core repository provides "formulae" for PHP 7.4, 8.0, 8.1, 8.2 and PHP 8.3. Install the latest version with this command: +[Homebrew] is a package manager for macOS that helps you easily install PHP and various extensions. The Homebrew core repository provides "formulae" for PHP 8.1, 8.2, 8.3 and 8.4. Install the latest version with this command: ``` -brew install php@8.3 +brew install php ``` You can switch between Homebrew PHP versions by modifying your `PATH` variable. Alternatively, you can use [brew-php-switcher][brew-php-switcher] to switch PHP versions automatically.