mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-05 21:47:32 +02:00
Update with minor grammar fixes
This commit is contained in:
@@ -26,7 +26,7 @@ command-line, X11 or Aqua based open-source software on the OS X operating
|
||||
system.
|
||||
|
||||
MacPorts supports pre-compiled binaries, so you don't need to recompile every
|
||||
dependencies from the source tarball files, it saves your life if you don't
|
||||
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` or `php70` using the `port install` command, for example:
|
||||
@@ -34,7 +34,7 @@ At this point, you can install `php54`, `php55`, `php56` or `php70` using the `p
|
||||
sudo port install php56
|
||||
sudo port install php70
|
||||
|
||||
And you can run `select` command to switch your active php:
|
||||
And you can run `select` command to switch your active PHP:
|
||||
|
||||
sudo port select --set php php70
|
||||
|
||||
@@ -46,7 +46,7 @@ applications/projects require different versions of PHP, and you are not using v
|
||||
### Install PHP via Liip's binary installer
|
||||
|
||||
Another popular option is [php-osx.liip.ch] which provides one liner installation methods for versions 5.3 through 7.0.
|
||||
It doesn't overwrite the php binaries installed by Apple, but installs everything in a separate location (/usr/local/php5).
|
||||
It doesn't overwrite the PHP binaries installed by Apple, but installs everything in a separate location (/usr/local/php5).
|
||||
|
||||
### Compile from Source
|
||||
|
||||
|
@@ -7,13 +7,13 @@ anchor: windows_setup
|
||||
|
||||
You can download the binaries from [windows.php.net/download][php-downloads]. After the extraction of PHP, it is recommended to set the [PATH][windows-path] to the root of your PHP folder (where php.exe is located) so you can execute PHP from anywhere.
|
||||
|
||||
For learning and local development you can use the built in webserver with PHP 5.4+ so you don't need to worry about
|
||||
For learning and local development, you can use the built in webserver with PHP 5.4+ so you don't need to worry about
|
||||
configuring it. If you would like an "all-in-one" which includes a full-blown webserver and MySQL too then tools such
|
||||
as the [Web Platform Installer][wpi], [XAMPP][xampp], [EasyPHP][easyphp], [OpenServer][openserver] and [WAMP][wamp] will
|
||||
help get a Windows development environment up and running fast. That said, these tools will be a little different from
|
||||
production so be careful of environment differences if you are working on Windows and deploying to Linux.
|
||||
|
||||
If you need to run your production system on Windows then IIS7 will give you the most stable and best performance. You
|
||||
If you need to run your production system on Windows, then IIS7 will give you the most stable and best performance. You
|
||||
can use [phpmanager][phpmanager] (a GUI plugin for IIS7) to make configuring and managing PHP simple. IIS7 comes with
|
||||
FastCGI built in and ready to go, you just need to configure PHP as a handler. For support and additional resources
|
||||
there is a [dedicated area on iis.net][php-iis] for PHP.
|
||||
|
@@ -24,7 +24,7 @@ In October 2014 the PHP-FIG deprecated the previous autoloading standard: [PSR-0
|
||||
many PHP 5.2-only projects currently implement PSR-0. Luckily those PHP 5.2-only projects are starting to up their
|
||||
version requirements, meaning PSR-0 is being used less and less.
|
||||
|
||||
If you're going to use an autoloader standard for a new application or package then you almost certainly want
|
||||
If you're going to use an autoloader standard for a new application or package, then you almost certainly want
|
||||
to look into PSR-4.
|
||||
|
||||
* [Read about Namespaces][namespaces]
|
||||
|
@@ -79,7 +79,7 @@ as a dependency of your project.
|
||||
composer require twig/twig:~1.8
|
||||
{% endhighlight %}
|
||||
|
||||
Alternatively the `composer init` command will guide you through creating a full `composer.json` file
|
||||
Alternatively, the `composer init` command will guide you through creating a full `composer.json` file
|
||||
for your project. Either way, once you've created your `composer.json` file you can tell Composer to
|
||||
download and install your dependencies into the `vendor/` directory. This also applies to projects
|
||||
you've downloaded that already provide a `composer.json` file:
|
||||
@@ -106,7 +106,7 @@ first ran `composer install`. If you share your project with other coders and th
|
||||
is part of your distribution, when they run `composer install` they'll get the same versions as you.
|
||||
To update your dependencies, run `composer update`.
|
||||
|
||||
This is most useful when you define your version requirements flexibly. For instance a version
|
||||
This is most useful when you define your version requirements flexibly. For instance, a version
|
||||
requirement of `~1.8` means "anything newer than `1.8.0`, but less than `2.0.x-dev`". You can also use
|
||||
the `*` wildcard as in `1.8.*`. Now Composer's `composer update` command will upgrade all your
|
||||
dependencies to the newest version that fits the restrictions you define.
|
||||
|
@@ -57,7 +57,7 @@ handle your PEAR dependencies. This example will install code from `pear2.php.ne
|
||||
{% endhighlight %}
|
||||
|
||||
The first section `"repositories"` will be used to let Composer know it should "initialize" (or "discover" in PEAR
|
||||
terminology) the pear repo. Then the require section will prefix the package name like this:
|
||||
terminology) the pear repo. Then the required section will prefix the package name like this:
|
||||
|
||||
> pear-channel/Package
|
||||
|
||||
|
@@ -6,7 +6,7 @@ anchor: the_basics
|
||||
## The Basics {#the_basics_title}
|
||||
|
||||
PHP is a vast language that allows coders of all levels the ability to produce code not only quickly, but efficiently.
|
||||
However while advancing through the language, we often forget the basics that we first learnt (or overlooked) in favor
|
||||
However, while advancing through the language, we often forget the basics that we first learnt (or overlooked) in favor
|
||||
of short cuts and/or bad habits. To help combat this common issue, this section is aimed at reminding coders of the
|
||||
basic coding practices within PHP.
|
||||
|
||||
|
@@ -18,7 +18,7 @@ for a brief, practical summary.
|
||||
### UTF-8 at the PHP level
|
||||
|
||||
The basic string operations, like concatenating two strings and assigning strings to variables, don't need anything
|
||||
special for UTF-8. However most string functions, like `strpos()` and `strlen()`, do need special consideration. These
|
||||
special for UTF-8. However, most string functions, like `strpos()` and `strlen()`, do need special consideration. These
|
||||
functions often have an `mb_*` counterpart: for example, `mb_strpos()` and `mb_strlen()`. These `mb_*` strings are made
|
||||
available to you via the [Multibyte String Extension], and are specifically designed to operate on Unicode strings.
|
||||
|
||||
|
@@ -10,7 +10,7 @@ If you have ever read about Dependency Injection then you have probably seen the
|
||||
|
||||
### Inversion of Control
|
||||
|
||||
Inversion of Control is as it says, "inverting the control" of a system by keeping organisational control entirely
|
||||
Inversion of Control is as it says, "inverting the control" of a system by keeping organizational control entirely
|
||||
separate from our objects. In terms of Dependency Injection, this means loosening our dependencies by controlling and
|
||||
instantiating them elsewhere in the system.
|
||||
|
||||
|
@@ -19,7 +19,7 @@ foreach ($db->query('SELECT * FROM table') as $row) {
|
||||
</ul>
|
||||
{% endhighlight %}
|
||||
|
||||
This is bad practice for all sorts of reasons, mainly that its hard to debug, hard to test, hard to read and it is
|
||||
This is bad practice for all sorts of reasons, mainly that it's hard to debug, hard to test, hard to read and it is
|
||||
going to output a lot of fields if you don't put a limit on there.
|
||||
|
||||
While there are many other solutions to doing this - depending on if you prefer [OOP](/#object-oriented-programming) or
|
||||
|
@@ -8,8 +8,8 @@ anchor: password_hashing
|
||||
Eventually everyone builds a PHP application that relies on user login. Usernames and passwords are stored in a
|
||||
database and later used to authenticate users upon login.
|
||||
|
||||
It is important that you properly [_hash_][3] passwords before storing them. Password hashing is an irreversible, one
|
||||
way function performed against the user's password. This produces a fixed-length string that cannot be feasibly
|
||||
It is important that you properly [_hash_][3] passwords before storing them. Password hashing is an irreversible,
|
||||
one-way function performed against the user's password. This produces a fixed-length string that cannot be feasibly
|
||||
reversed. This means you can compare a hash against another to determine if they both came from the same source string,
|
||||
but you cannot determine the original string. If passwords are not hashed and your database is accessed by an
|
||||
unauthorized third-party, all user accounts are now compromised. Some users may (unfortunately) use the same password
|
||||
|
@@ -14,4 +14,4 @@ via the file system.
|
||||
that, even if the script is accessed directly, it will not be output as plain text.
|
||||
- Information in configuration files should be protected accordingly, either through encryption or group/user file
|
||||
system permissions.
|
||||
- It is a good idea to ensure that you do not commit configuration files containing sensitive information eg passwords or API tokens to source control.
|
||||
- It is a good idea to ensure that you do not commit configuration files containing sensitive information e.g. passwords or API tokens to source control.
|
||||
|
@@ -9,6 +9,6 @@ PHP has shared servers to thank for its popularity. It is hard to find a host wi
|
||||
the latest version. Shared servers allow you and other developers to deploy websites to a single machine. The upside to
|
||||
this is that it has become a cheap commodity. The downside is that you never know what kind of a ruckus your
|
||||
neighboring tenants are going to create; loading down the server or opening up security holes are the main concerns. If
|
||||
your project's budget can afford to avoid shared servers you should.
|
||||
your project's budget can afford to avoid shared servers, you should.
|
||||
|
||||
To make sure your shared servers are offering the latest versions of PHP, check out [PHP Versions](http://phpversions.info/shared-hosting/).
|
||||
|
@@ -6,7 +6,7 @@ title: Video Tutorials
|
||||
|
||||
## Video Tutorials {#videos}
|
||||
|
||||
### Youtube Channels
|
||||
### YouTube Channels
|
||||
* [PHP Academy](https://www.youtube.com/user/phpacademy)
|
||||
* [The New Boston](https://www.youtube.com/user/thenewboston)
|
||||
* [Sherif Ramadan](https://www.youtube.com/user/businessgeek)
|
||||
|
@@ -7,7 +7,7 @@ anchor: user_groups
|
||||
|
||||
If you live in a larger city, odds are there's a PHP user group nearby. You can easily find your local PUG at
|
||||
the [usergroup-list at php.net][php-uglist] which is based upon [PHP.ug][php-ug]. Alternate sources might be
|
||||
[Meetup.com][meetup] or a search for ```php user group near me``` using your favourite search engine
|
||||
[Meetup.com][meetup] or a search for ```php user group near me``` using your favorite search engine
|
||||
(i.e. [Google][google]). If you live in a smaller town, there may not be a local PUG; if that's the case, start one!
|
||||
|
||||
Special mention should be made of two global user groups: [NomadPHP] and [PHPWomen]. [NomadPHP] offers twice monthly
|
||||
|
Reference in New Issue
Block a user