Skip to content

Commit 9905e93

Browse files
authored
Merge pull request #1 from codeguy/gh-pages
update to nov 2023
2 parents b39a710 + 40f42ca commit 9905e93

File tree

65 files changed

+400
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+400
-341
lines changed

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.8

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to PHP The Right Way
22

3-
Enjoy [PHP The Right Way](http://phptherightway.com) and want to get
3+
Enjoy [PHP The Right Way](https://phptherightway.com) and want to get
44
involved? Great! There are plenty of ways you can help out.
55

66
Please take a moment to review this document in order to make the contribution
@@ -20,7 +20,7 @@ content and generally [submitting pull requests](#pull-requests), but please
2020
respect the following restrictions:
2121

2222
* Please **do not** use the issue tracker for personal support requests (use
23-
[Stack Overflow](http://stackoverflow.com/questions/tagged/php) or IRC).
23+
[Stack Overflow](https://stackoverflow.com/questions/tagged/php) or IRC).
2424

2525
* Please **do not** derail or troll issues. Keep the discussion on topic and
2626
respect the opinions of others.
@@ -36,8 +36,8 @@ change is accepted if seen as constructive.
3636
Adhering to the following process is the best way to get your work
3737
included in the project:
3838

39-
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
40-
and configure the remotes:
39+
1. [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the
40+
project, clone your fork, and configure the remotes:
4141

4242
```bash
4343
# Clone your fork of the repo into the current directory
@@ -72,9 +72,9 @@ included in the project:
7272
```
7373

7474
5. Commit your changes in logical chunks. Please adhere to these [git commit
75-
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
75+
message guidelines](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
7676
or your content is unlikely be merged into the main project. Use Git's
77-
[interactive rebase](https://help.github.com/articles/about-git-rebase/)
77+
[interactive rebase](https://docs.github.com/en/get-started/using-git/about-git-rebase)
7878
feature to tidy up your commits before making them public.
7979
8080
6. Locally merge (or rebase) the upstream development branch into your topic branch:
@@ -89,20 +89,20 @@ included in the project:
8989
git push origin <topic-branch-name>
9090
```
9191
92-
8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
92+
8. [Open a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
9393
with a clear title and description.
9494
9595
9696
## Contribution Agreement and Usage
9797
9898
By submitting a pull request to this repository, you agree to allow the project
9999
owners to license your work under the the terms of the [Creative Commons Attribution-NonCommercial-ShareAlike
100-
3.0 Unported License](http://creativecommons.org/licenses/by-nc-sa/3.0/).
100+
3.0 Unported License](https://creativecommons.org/licenses/by-nc-sa/3.0/).
101101
102102
The same content and license will be used for all PHP The Right Way publications,
103103
including - but not limited to:
104104
105-
* [phptherightway.com](http://phptherightway.com)
105+
* [phptherightway.com](https://phptherightway.com)
106106
* Translations of phptherightway.com
107107
* [LeanPub: PHP The Right Way](https://leanpub.com/phptherightway/)
108108
* Translations of "LeanPub: PHP The Right Way"
@@ -116,4 +116,4 @@ All content is completely free now, and always will be.
116116
3. Wrap all text to 120 characters
117117
4. Code samples should adhere to PSR-1 or higher
118118
5. Use [GitHub Flavored Markdown](https://github.github.com/gfm/) for all content
119-
6. Use language agnostic urls when referring to external websites such as the [php.net](http://php.net/urlhowto.php) manual
119+
6. Use language agnostic urls when referring to external websites such as the [php.net](https://www.php.net/urlhowto.php) manual

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Copyright (c) 2013 Josh Lockhart
22

3-
http://creativecommons.org/licenses/by-nc-sa/3.0/
3+
https://creativecommons.org/licenses/by-nc-sa/3.0/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You should read the `CONTRIBUTING.md` file for precise instructions and tips. Bu
2626

2727
### Contributor Style Guide
2828

29-
1. Use American English spelling (*primary English repo only*)
29+
1. Use American English spelling (*primary English repo only*).
3030
2. Use four (4) spaces to indent text; do not use tabs.
3131
3. Wrap all text to 120 characters.
3232
4. Code samples should adhere to PSR-1 or higher.

_includes/welcome.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
There's a lot of outdated information on the Web that leads new PHP users astray,
44
propagating bad practices and insecure code. _PHP: The Right Way_ is an easy-to-read,
55
quick reference for PHP popular coding standards, links to authoritative tutorials
6-
around the Web and what the contributors consider to be best practices at the present
7-
time.
6+
around the Web, and what the contributors consider to be best practices at present.
87

98
_There is no canonical way to use PHP_. This website aims to introduce new PHP
109
developers to some topics which they may not discover until it is too late, and aims
@@ -20,25 +19,26 @@ and examples as they become available.
2019

2120
_PHP: The Right Way_ is translated into many different languages:
2221

23-
* [English](http://www.phptherightway.com)
24-
* [Español](http://phpdevenezuela.github.io/php-the-right-way)
25-
* [Français](http://eilgin.github.io/php-the-right-way/)
26-
* [Indonesia](http://id.phptherightway.com)
27-
* [Italiano](http://it.phptherightway.com)
28-
* [Polski](http://pl.phptherightway.com)
29-
* [Português do Brasil](http://br.phptherightway.com)
22+
* [English](https://www.phptherightway.com)
23+
* [Deutsch](https://rwetzlmayr.github.io/php-the-right-way)
24+
* [Español](https://phpdevenezuela.github.io/php-the-right-way)
25+
* [Français](https://eilgin.github.io/php-the-right-way/)
26+
* [Indonesia](https://id.phptherightway.com)
27+
* [Italiano](https://it.phptherightway.com)
28+
* [Polski](https://pl.phptherightway.com)
29+
* [Português do Brasil](https://br.phptherightway.com)
3030
* [Română](https://bgui.github.io/php-the-right-way/)
31-
* [Slovenščina](http://sl.phptherightway.com)
32-
* [Srpski](http://phpsrbija.github.io/php-the-right-way/)
33-
* [Türkçe](http://hkulekci.github.io/php-the-right-way/)
34-
* [български](http://bg.phptherightway.com)
35-
* [Русский язык](http://getjump.github.io/ru-php-the-right-way)
36-
* [Українська](http://iflista.github.io/php-the-right-way/)
31+
* [Slovenščina](https://sl.phptherightway.com)
32+
* [Srpski](https://phpsrbija.github.io/php-the-right-way/)
33+
* [Türkçe](https://hkulekci.github.io/php-the-right-way/)
34+
* [български](https://bg.phptherightway.com)
35+
* [Русский язык](https://getjump.github.io/ru-php-the-right-way)
36+
* [Українська](https://iflista.github.io/php-the-right-way/)
3737
* [العربية](https://adaroobi.github.io/php-the-right-way/)
38-
* [فارسى](http://novid.github.io/php-the-right-way/)
38+
* [فارسى](https://novid.github.io/php-the-right-way/)
3939
* [ภาษาไทย](https://apzentral.github.io/php-the-right-way/)
40-
* [한국어판](http://modernpug.github.io/php-the-right-way)
41-
* [日本語](http://ja.phptherightway.com)
40+
* [한국어판](https://modernpug.github.io/php-the-right-way)
41+
* [日本語](https://ja.phptherightway.com)
4242
* [简体中文](https://laravel-china.github.io/php-the-right-way/)
4343
* [繁體中文](https://laravel-taiwan.github.io/php-the-right-way)
4444

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
---
2-
title: Use the Current Stable Version (8.1)
2+
title: Use the Current Stable Version (8.2)
33
isChild: true
44
anchor: use_the_current_stable_version
55
---
66

7-
## Use the Current Stable Version (8.1) {#use_the_current_stable_version_title}
7+
## Use the Current Stable Version (8.2) {#use_the_current_stable_version_title}
88

9-
If you are getting started with PHP, start with the current stable release of [PHP 8.1][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.
9+
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.
1010

11-
You should try to upgrade to the latest stable version quickly - PHP 5.6 [is already End of Life](http://php.net/supported-versions.php). Upgrading is easy, as there are not many [backwards compatibility breaks][php-bc]. 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.
11+
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.
1212

13-
[php-release]: http://php.net/downloads.php
14-
[php-docs]: http://php.net/manual/
15-
[php-bc]: http://php.net/manual/migration81.incompatible.php
13+
[php-release]: https://www.php.net/downloads.php
14+
[php-supported]: https://www.php.net/supported-versions.php
15+
[php-docs]: https://www.php.net/manual/
16+
[php-bc-80]: https://www.php.net/manual/migration80.incompatible.php
17+
[php-bc-81]: https://www.php.net/manual/migration81.incompatible.php
18+
[php-bc-82]: https://www.php.net/manual/migration82.incompatible.php

_posts/01-03-01-Built-in-Web-Server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ To start the server, run the following command from your terminal in your projec
1616
* [Learn about the built-in, command line web server][cli-server]
1717

1818

19-
[cli-server]: http://php.net/features.commandline.webserver
19+
[cli-server]: https://www.php.net/features.commandline.webserver

_posts/01-04-01-Mac-Setup.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ isChild: true
33
anchor: mac_setup
44
---
55

6-
## Mac Setup {#mac_setup_title}
6+
## macOS Setup {#mac_setup_title}
77

88
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.
99

1010
### Install PHP via Homebrew
1111

12-
[Homebrew] is a package manager for macOS that helps you easily install PHP and various extensions. The Homebrew core repository provides "formulae" for PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and PHP 8.1. Install the latest version with this command:
12+
[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:
1313

1414
```
15-
brew install php@8.1
15+
brew install php@8.2
1616
```
1717

1818
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,33 +21,33 @@ You can also switch between PHP versions manually by unlinking and linking the w
2121

2222
```
2323
brew unlink php
24-
brew link --overwrite php@8.0
24+
brew link --overwrite php@8.1
2525
```
2626

2727
```
2828
brew unlink php
29-
brew link --overwrite php@8.1
29+
brew link --overwrite php@8.2
3030
```
3131

3232
### Install PHP via Macports
3333

3434
The [MacPorts] Project is an open-source community initiative to design an
3535
easy-to-use system for compiling, installing, and upgrading either
36-
command-line, X11 or Aqua based open-source software on the OS X operating
36+
command-line, X11 or Aqua based open-source software on the macOS operating
3737
system.
3838

3939
MacPorts supports pre-compiled binaries, so you don't need to recompile every
4040
dependency from the source tarball files, it saves your life if you don't
4141
have any package installed on your system.
4242

43-
At this point, you can install `php54`, `php55`, `php56`, `php70`, `php71`, `php72`, `php73`, `php74`, `php80` or `php81` using the `port install` command, for example:
43+
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:
4444

4545
sudo port install php74
46-
sudo port install php81
46+
sudo port install php82
4747

4848
And you can run `select` command to switch your active PHP:
4949

50-
sudo port select --set php php81
50+
sudo port select --set php php82
5151

5252
### Install PHP via phpbrew
5353

@@ -63,7 +63,7 @@ It doesn't overwrite the PHP binaries installed by Apple, but installs everythin
6363

6464
Another option that gives you control over the version of PHP you install, is to [compile it yourself][mac-compile].
6565
In that case be sure to have installed either [Xcode][xcode-gcc-substitution] or Apple's substitute
66-
["Command Line Tools for XCode"] downloadable from Apple's Mac Developer Center.
66+
["Command Line Tools for XCode"] downloadable from Apple's Developer Center.
6767

6868
### All-in-One Installers
6969

@@ -72,15 +72,14 @@ The solutions listed above mainly handle PHP itself, and do not supply things li
7272
you and tie them all together, but ease of setup comes with a trade-off of flexibility.
7373

7474
[Homebrew]: https://brew.sh/
75-
[Homebrew PHP]: https://github.com/Homebrew/homebrew-php#installation
7675
[MacPorts]: https://www.macports.org/install.php
7776
[phpbrew]: https://github.com/phpbrew/phpbrew
78-
[php-osx.liip.ch]: https://php-osx.liip.ch/
79-
[mac-compile]: https://secure.php.net/install.macosx.compile
77+
[php-osx.liip.ch]: https://web.archive.org/web/20220505163210/https://php-osx.liip.ch/
78+
[mac-compile]: https://www.php.net/install.macosx.compile
8079
[xcode-gcc-substitution]: https://github.com/kennethreitz/osx-gcc-installer
8180
["Command Line Tools for XCode"]: https://developer.apple.com/downloads
8281
[apache]: https://httpd.apache.org/
8382
[nginx]: https://www.nginx.com/
8483
[mamp-downloads]: https://www.mamp.info/en/downloads/
85-
[xampp]: https://www.apachefriends.org/index.html
84+
[xampp]: https://www.apachefriends.org/
8685
[brew-php-switcher]: https://github.com/philcook/brew-php-switcher

_posts/01-05-01-Windows-Setup.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ live. If you are developing on Windows and deploying to Linux (or anything non-W
2323

2424
Chris Tankersley has a very helpful blog post on what tools he uses to do [PHP development using Windows][windows-tools].
2525

26-
[easyphp]: http://www.easyphp.org/
26+
[easyphp]: https://www.easyphp.org/
2727
[phpmanager]: http://phpmanager.codeplex.com/
28-
[openserver]: http://open-server.ru/
29-
[wamp]: http://www.wampserver.com/en/
30-
[php-downloads]: http://windows.php.net/download/
31-
[php-iis]: http://php.iis.net/
32-
[windows-path]: http://www.windows-commandline.com/set-path-command-line/
33-
[windows-tools]: http://ctankersley.com/2016/11/13/developing-on-windows-2016/
34-
[xampp]: http://www.apachefriends.org/en/xampp.html
28+
[openserver]: https://ospanel.io/
29+
[wamp]: https://www.wampserver.com/en/
30+
[php-downloads]: https://windows.php.net/download/
31+
[php-iis]: https://php.iis.net/
32+
[windows-path]: https://www.windows-commandline.com/set-path-command-line/
33+
[windows-tools]: https://ctankersley.com/2016/11/13/developing-on-windows-2016/
34+
[xampp]: https://www.apachefriends.org/

_posts/01-06-01-Linux-Setup.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
isChild: true
3+
anchor: linux_setup
4+
---
5+
6+
## Linux Setup {#linux_setup_title}
7+
8+
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.
9+
10+
### Ubuntu-based distributions
11+
12+
For Ubuntu distributions, the [PPA by Ondřej Surý][Ondrej Sury PPA] provides supported PHP versions along with many PECL extensions. To add this PPA to your system, perform the following steps in your terminal:
13+
14+
1. First, add the PPA to your system's software sources using the command:
15+
16+
```bash
17+
sudo add-apt-repository ppa:ondrej/php
18+
```
19+
20+
2. After adding the PPA, update your system's package list:
21+
22+
```bash
23+
sudo apt update
24+
```
25+
26+
This will ensure that your system can access and install the latest PHP packages available in the PPA.
27+
28+
#### Debian-based distributions
29+
30+
For Debian-based distributions, Ondřej Surý also provides a [bikeshed][bikeshed] (Debian equivalent of a PPA). To add the bikeshed to your system and update it, follow these steps:
31+
32+
1. Ensure that you have root access. If not, you might need to use `sudo` for the following commands.
33+
34+
2. Update your system's package list:
35+
36+
```bash
37+
sudo apt-get update
38+
```
39+
40+
3. Install `lsb-release`, `ca-certificates`, and `curl`:
41+
42+
```bash
43+
sudo apt-get -y install lsb-release ca-certificates curl
44+
```
45+
46+
4. Download the signing key for the repository:
47+
48+
```bash
49+
sudo curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
50+
```
51+
52+
5. Add the repository to your system's software sources:
53+
54+
```bash
55+
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
56+
```
57+
58+
6. Finally, update your system's package list again:
59+
60+
```bash
61+
sudo apt-get update
62+
```
63+
64+
With these steps, your system will be able to install the latest PHP packages from the bikeshed.
65+
66+
[Ondrej Sury Blog]: https://deb.sury.org/
67+
[Ondrej Sury PPA]: https://launchpad.net/~ondrej/+archive/ubuntu/php
68+
[bikeshed]: https://packages.sury.org/php/

_posts/01-06-01-Common-Directory-Structure.md renamed to _posts/01-07-01-Common-Directory-Structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ For each team, CMS, or framework one works in, a standard directory structure is
1414

1515
[Paul M. Jones] has done some fantastic research into common practices of tens of thousands of github projects in the realm of PHP. He has compiled a standard file and directory structure, the [Standard PHP Package Skeleton], based on this research. In this directory structure, `DocumentRoot` should point to `public/`, unit tests should be in the `tests/` directory, and third party libraries, as installed by [composer], belong in the `vendor/` directory. For other files and directories, abiding by the [Standard PHP Package Skeleton] will make the most sense to contributors of a project.
1616

17-
[Paul M. Jones]: http://paul-m-jones.com/
17+
[Paul M. Jones]: https://paul-m-jones.com/
1818
[Standard PHP Package Skeleton]: https://github.com/php-pds/skeleton
1919
[Composer]: /#composer_and_packagist

0 commit comments

Comments
 (0)