From 6ffa3013994a19f715973c63d7f71b55837bb43b Mon Sep 17 00:00:00 2001 From: Vladimir Kovpak Date: Sun, 15 Mar 2015 01:31:17 +0200 Subject: [PATCH 001/127] Add information about SOLID. --- _posts/06-03-01-Complex-Problem.md | 32 ++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md index 0d6f907..1ab6c12 100644 --- a/_posts/06-03-01-Complex-Problem.md +++ b/_posts/06-03-01-Complex-Problem.md @@ -22,9 +22,37 @@ instead of loosening dependencies, this method simply moved them. Dependency Injection allows us to more elegantly solve this problem by only injecting the dependencies we need, when we need them, without the need for any hard coded dependencies at all. -### Dependency Inversion Principle +### SOLID -Dependency Inversion Principle is the "D" in the S.O.L.I.D set of object oriented design principles that states one +#### Single responsibility principle + +It's very helpful principle because it improve code reusability and +states that every class should have responsibility over a single part of the functionality provided by the software. +Your class should do just one thing and no more. And you can use it in any place of program without changing it. + +#### Open/closed principle + +States that classes should be open for extension, but closed for modification. +it's very important and helpful especially in production, +because it provides ability to change program behaviour without changing source code. + +#### Liskov substitution principle + +This principle extends previous principle, and states +if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S +without altering any class of the program. +That's amazing principle provides ability to build very flexible and easily configurable programs +because when you change one object to another you don't need to change anything in your program. + +#### Interface segregation principle + +Splits interfaces which are very large into smaller and more specific ones. +It provides to work in each time only with methods that interesting for client, +and facilitate conceptual explanation of the code. + +#### Dependency Inversion Principle + +Dependency Inversion Principle set of object oriented design principles that states one should *"Depend on Abstractions. Do not depend on concretions."*. Put simply, this means our dependencies should be interfaces/contracts or abstract classes rather than concrete implementations. We can easily refactor the above example to follow this principle. From d57d2f142f8d48737055228136bdd88f13457bd2 Mon Sep 17 00:00:00 2001 From: Ryan Parman Date: Sun, 4 Oct 2015 12:50:22 -0700 Subject: [PATCH 002/127] Expanded and clarified the language around SOLID principles. --- _posts/06-03-01-Complex-Problem.md | 69 +++++++++++++++++++----------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md index 1ab6c12..61aecc8 100644 --- a/_posts/06-03-01-Complex-Problem.md +++ b/_posts/06-03-01-Complex-Problem.md @@ -15,47 +15,66 @@ separate from our objects. In terms of Dependency Injection, this means loosenin instantiating them elsewhere in the system. For years, PHP frameworks have been achieving Inversion of Control, however, the question became, which part of control -are you inverting, and where to? For example, MVC frameworks would generally provide a super object or base controller +are we inverting, and where to? For example, MVC frameworks would generally provide a super object or base controller that other controllers must extend to gain access to its dependencies. This **is** Inversion of Control, however, instead of loosening dependencies, this method simply moved them. Dependency Injection allows us to more elegantly solve this problem by only injecting the dependencies we need, when we need them, without the need for any hard coded dependencies at all. -### SOLID +### S.O.L.I.D. -#### Single responsibility principle +#### Single Responsibility Principle -It's very helpful principle because it improve code reusability and -states that every class should have responsibility over a single part of the functionality provided by the software. -Your class should do just one thing and no more. And you can use it in any place of program without changing it. +The Single Responsibility Principle is about actors and high-level architecture. It states that “A class should have +only one reason to change.” This means that every class should _only_ have responsibility over a single part of the +functionality provided by the software. The largest benefit of this approach is that it enables improved code +_reusability_. By designing our class to do just one thing, we can use (or re-use) it in any other program without +changing it. -#### Open/closed principle +#### Open/Closed Principle -States that classes should be open for extension, but closed for modification. -it's very important and helpful especially in production, -because it provides ability to change program behaviour without changing source code. +The Open/Closed Principle is about class design and feature extensions. It states that “Software entities (classes, +modules, functions, etc.) should be open for extension, but closed for modification.” This means that we should design +our modules, classes and functions in a way that when a new functionality is needed, we should not modify our existing +code but rather write new code that will be used by existing code. Practically speaking, this means that we should write +classes that implement and adhere to _interfaces_, then type-hint against those interfaces instead of specific classes. -#### Liskov substitution principle +The largest benefit of this approach is that we can very easily extend our code with support for something new without +having to modify existing code, meaning that we can reduce QA time, and the risk for negative impact to the application +is substantially reduced. We can deploy new code, faster, and with more confidence. -This principle extends previous principle, and states -if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S -without altering any class of the program. -That's amazing principle provides ability to build very flexible and easily configurable programs -because when you change one object to another you don't need to change anything in your program. +#### Liskov Substitution Principle -#### Interface segregation principle +The Liskov Substitution Principle is about subtyping and inheritance. It states that “Child classes should never break +the parent class’ type definitions.” Or, in Robert C. Martin’s words, “Subtypes must be substitutable for their base +types.” -Splits interfaces which are very large into smaller and more specific ones. -It provides to work in each time only with methods that interesting for client, -and facilitate conceptual explanation of the code. +For example, if we have a `FileInterface` interface which defines an `embed()` method, and we have `Audio` and `Video` +classes which both implement the `embed()` method, then we can expect that the usage of the `embed()` method will always +do the thing that we intend. If we later create a `PDF` class or a `Gist` class which implement the `FileInterface` +interface, we will already know and understand what the `embed()` method will do. The largest benefit of this approach +is that we have the ability to build flexible and easily-configurable programs, because when we change one object of a +type (e.g., `FileInterface`) to another we don't need to change anything else in our program. + +#### Interface Segregation Principle + +The Interface Segregation Principle (ISP) is about _business-logic-to-clients_ communication. It states that “No client +should be forced to depend on methods it does not use.” This means that instead of having a single monolithic interface +that all conforming classes need to implement, we should instead provide a set of smaller, concept-specific interfaces +that a conforming class implements one or more of. + +For example, a `Car` or `Bus` class would be interested in a `steeringWheel()` method, but a `Motorcycle` or `Tricycle` +class would not. Conversely, a `Motorcycle` or `Tricycle` class would be interested in a `handlebars()` method, but a +`Car` or `Bus` class would not. There is no need to have all of these types of vehicles implement support for both +`steeringWheel()` as well as `handlebars()`, so we should break-apart the source interface. #### Dependency Inversion Principle -Dependency Inversion Principle set of object oriented design principles that states one -should *"Depend on Abstractions. Do not depend on concretions."*. Put simply, this means our dependencies should be -interfaces/contracts or abstract classes rather than concrete implementations. We can easily refactor the above example -to follow this principle. +The Dependency Inversion Principle is about removing hard-links between discrete classes so that new functionality can +be leveraged by passing a different class. It states that one should *"Depend on Abstractions. Do not depend on +concretions."*. Put simply, this means our dependencies should be interfaces/contracts or abstract classes rather than +concrete implementations. We can easily refactor the above example to follow this principle. {% highlight php %} Date: Fri, 26 Feb 2016 15:15:44 +0100 Subject: [PATCH 003/127] Improve word order The text should reflect the code. --- _posts/09-02-01-Errors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/09-02-01-Errors.md b/_posts/09-02-01-Errors.md index d495f8b..fd2bf64 100644 --- a/_posts/09-02-01-Errors.md +++ b/_posts/09-02-01-Errors.md @@ -48,7 +48,7 @@ changes to your code to help ensure best interoperability and forward compatibil Error Reporting can be changed by using PHP settings and/or PHP function calls. Using the built in PHP function `error_reporting()` you can set the level of errors for the duration of the script execution by passing one of the -predefined error level constants, meaning if you only want to see Warnings and Errors - but not Notices - then you can +predefined error level constants, meaning if you only want to see Errors and Warnings - but not Notices - then you can configure that: {% highlight php %} From d7f9db00808bf0132839334a38f4184a6471aa8c Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Sat, 27 Feb 2016 14:51:28 -0300 Subject: [PATCH 004/127] Adding weeklies to resources page --- _posts/16-08-01-Sites.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/_posts/16-08-01-Sites.md b/_posts/16-08-01-Sites.md index a5189dc..7eaedca 100644 --- a/_posts/16-08-01-Sites.md +++ b/_posts/16-08-01-Sites.md @@ -17,6 +17,17 @@ PHP versions * [PHP Best Practices](https://phpbestpractices.org/) * [Best practices for Modern PHP Development](https://www.airpair.com/php/posts/best-practices-for-modern-php-development) +### News around the PHP and web development communities +You can subscribe to weekly newsletters to keep yourself informed on new libraries, latest news, events and general +announcements, as well as additional resources being published every now and then: + +* [PHP Weekly](http://www.phpweekly.com) +* [JavaScript Weekly](http://javascriptweekly.com) +* [HTML5 Weekly](http://html5weekly.com) +* [Mobile Web Weekly](http://mobilewebweekly.co) +* There are also Weeklies on other platforms you might be interested in; here's +[a list of some](https://github.com/jondot/awesome-weekly). + ### PHP universe * [PHP Developer blog](http://blog.phpdeveloper.org/) From a003a5b92603f1f58f5b54aa18a01e37a02c6184 Mon Sep 17 00:00:00 2001 From: Rodrigo Prado Date: Sat, 26 Mar 2016 09:02:17 -0300 Subject: [PATCH 005/127] added complementary word Brazil to pt translation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cae591c..d276a7c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ developers know where to find good information! * [Korean](http://modernpug.github.io/php-the-right-way) * [Persian](http://novid.github.io/php-the-right-way/) * [Polish](http://pl.phptherightway.com) -* [Portuguese](http://br.phptherightway.com) +* [Portuguese (Brazil)](http://br.phptherightway.com) * [Romanian](https://bgui.github.io/php-the-right-way/) * [Russian](http://getjump.github.io/ru-php-the-right-way) * [Serbian](http://phpsrbija.github.io/php-the-right-way/) From 77da497c58da02d866bde50bd38b52afd5a1e253 Mon Sep 17 00:00:00 2001 From: Rodrigo Prado Date: Sat, 26 Mar 2016 09:06:15 -0300 Subject: [PATCH 006/127] added complementary word Brazil to pt translation --- _includes/welcome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 0504924..95aeb91 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -32,7 +32,7 @@ _PHP: The Right Way_ is translated into many different languages: * [Korean](http://modernpug.github.io/php-the-right-way/) * [Persian](http://novid.github.io/php-the-right-way/) * [Polish](http://pl.phptherightway.com/) -* [Portuguese](http://br.phptherightway.com/) +* [Portuguese (Brazil)](http://br.phptherightway.com/) * [Romanian](https://bgui.github.io/php-the-right-way/) * [Russian](http://getjump.github.io/ru-php-the-right-way) * [Serbian](http://phpsrbija.github.io/php-the-right-way/) From 19808f1f99504a13004e131086104ae36f706c10 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 5 Apr 2016 10:01:47 -0400 Subject: [PATCH 007/127] Update 16-10-01-Books.md --- _posts/16-10-01-Books.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index c8af275..a14d435 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -29,8 +29,8 @@ developer usually acquires over years of experience, all condensed down into one small, specific steps * [Securing PHP: Core Concepts](https://leanpub.com/securingphp-coreconcepts) - A guide to some of the most common security terms and provides some examples of them in every day PHP -* [Scaling PHP]( https://leanpub.com/scalingphp) - Stop playing sysadmin and get back to coding -* [Signaling PHP]( https://leanpub.com/signalingphp) - PCNLT signals are a great help when writing PHP scripts that +* [Scaling PHP](http://www.scalingphpbook.com/) - Stop playing sysadmin and get back to coding +* [Signaling PHP](https://leanpub.com/signalingphp) - PCNLT signals are a great help when writing PHP scripts that run from the command line. * [The Grumpy Programmer's Guide To Building Testable PHP Applications](https://leanpub.com/grumpy-testing) - Learning to write testable code doesn't have to suck From 83a7bd6920b61aa1d729e191b2fa35eb411a2d48 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Wed, 6 Apr 2016 20:42:43 +0100 Subject: [PATCH 008/127] Mention phpcbf in Coding Style Guide. --- _posts/02-01-01-Code-Style-Guide.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 4a3a7cb..cd77d03 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -15,7 +15,7 @@ recommendations are merely a set of rules that some projects like Drupal, Zend, FuelPHP, Lithium, etc are starting to adopt. You can use them for your own projects, or continue to use your own personal style. -Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSR's, or one +Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, and applications that implement the components can have consistency even when working with lots of third-party code. @@ -29,8 +29,11 @@ applications that implement the components can have consistency even when workin You can use [PHP_CodeSniffer][phpcs] to check code against any one of these recommendations, and plugins for text editors like [Sublime Text 2][st-cs] to be given real time feedback. -You can fix the code layout automatically by using one of the two following tools. One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. -Another option is [php.tools][phptools], which is made popular by the [sublime-phpfmt][sublime-phpfmt] editor plugin. While being newer, it makes great improvements in performance, meaning real-time editor fixing is more fluid. +You can fix the code layout automatically by using one of the following tools: + +- One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. +- Another option is [php.tools][phptools], which is made popular by the [sublime-phpfmt][sublime-phpfmt] editor plugin. While being newer, it makes great improvements in performance, meaning real-time editor fixing is more fluid. +- Also, the [PHP Code Beautifier and Fixer][phpcbf] tool which is included with PHP_CodeSniffer can be used to adjust your code accordingly. And you can run phpcs manually from shell: @@ -53,6 +56,7 @@ readable by all current and future parties who may be working on the codebase. [pear-cs]: http://pear.php.net/manual/en/standards.php [symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ +[phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ [phptools]: https://github.com/phpfmt/php.tools From a5e45069085f4fcc9393f965153af66f9a12363e Mon Sep 17 00:00:00 2001 From: Niklas Modess Date: Sun, 24 Apr 2016 16:30:56 +0800 Subject: [PATCH 009/127] change "build automation tools" to "deployment tools" --- _posts/12-05-01-Building-your-Application.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index 1ccf26b..eed3ccd 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -20,18 +20,13 @@ Among the tasks you might want to automate are: * Deployment -### Build Automation Tools +### Deployment Tools -Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool -is not a part of your software, it acts on your software from 'outside'. +Deployment tools can be described as a collection of scripts that handle common tasks of software deployment. The deployment tool is not a part of your software, it acts on your software from 'outside'. -There are many open source tools available to help you with build automation, some are written in PHP others aren't. -This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: +There are many open source tools available to help you with build automation and deployment, some are written in PHP others aren't. This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: -[Phing] is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your -packaging, deployment or testing process from within a simple XML build file. Phing (which is based on [Apache Ant]) -provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom -tasks, written in PHP. +[Phing] is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. [Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and From 23ee83395827c5fefe8b9bb51eb5b7cc929b3bbf Mon Sep 17 00:00:00 2001 From: Niklas Modess Date: Tue, 26 Apr 2016 09:52:37 +0800 Subject: [PATCH 010/127] updated information on phing --- _posts/12-05-01-Building-your-Application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index eed3ccd..8ddaf75 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -26,7 +26,7 @@ Deployment tools can be described as a collection of scripts that handle common There are many open source tools available to help you with build automation and deployment, some are written in PHP others aren't. This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: -[Phing] is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. +[Phing] can control your packaging, deployment or testing process from within an XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web application and can be extended with additional custom tasks, written in PHP. It's a solid and robust tool and has been around for a long time, however the tool could be perceived as a bit old fashioned because of the way it deals with configuration (XML files). [Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and From f4a04465d7c4d29f929fcd661af865b0e4ece085 Mon Sep 17 00:00:00 2001 From: Niklas Modess Date: Tue, 26 Apr 2016 09:53:20 +0800 Subject: [PATCH 011/127] updated deployment tools information and added rocketeer & magallanes --- _posts/12-05-01-Building-your-Application.md | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index 8ddaf75..b3b52bc 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -26,19 +26,17 @@ Deployment tools can be described as a collection of scripts that handle common There are many open source tools available to help you with build automation and deployment, some are written in PHP others aren't. This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: -[Phing] can control your packaging, deployment or testing process from within an XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web application and can be extended with additional custom tasks, written in PHP. It's a solid and robust tool and has been around for a long time, however the tool could be perceived as a bit old fashioned because of the way it deals with configuration (XML files). +[Phing] can control your packaging, deployment or testing process from within a XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web application and can be extended with additional custom tasks, written in PHP. It's a solid and robust tool and has been around for a long time, however the tool could be perceived as a bit old fashioned because of the way it deals with configuration (XML files). -[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way -on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and -Rake. +[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however you can successfully deploying PHP systems with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. Dave Gardner's blog post [PHP Deployment with Capistrano][phpdeploy_capistrano] is a good starting point for PHP developers interested in Capistrano. -Dave Gardner's blog post [PHP Deployment with Capistrano][phpdeploy_capistrano] is a good starting point for PHP -developers interested in Capistrano. +[Rocketeer] gets its inspiration and philosophy from the Laravel framework. Its goal is to be fast, elegant and ease to use with smart defaults. It features multiple servers, multiple stages, atomic deploys and deployment can be performed in parallel. Everything in the tool can be hot swapped or extended, and everything is written in PHP. -[Chef] is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't -just deploy your app but can build your whole server environment or virtual boxes. +[Deployer] is a deployment tool written in PHP, it's simple and functional. Runs tasks in parallel, atomic deployment, keeps consistency between servers. Recipes of common tasks for Symfony, Laravel, Zend Framework and Yii. Younes Rafie's article [Easy Deployment of PHP Applications with Deployer][phpdeploy_deployer] is a great tutorial for deploying your application with the tool. -[Deployer] is a deployment tool written in PHP, it's simple and functional. Runs tasks in parallel, atomic deployment, keeps consistency between servers. Recipes of common tasks for Symfony, Laravel, Zend Framework and Yii. +[Magallanes] another tool written in PHP with simple configuration done in YAML files. It has support for multiple servers and environments, atomic deployment, and have some built in tasks that you can leverage for common tools and frameworks. + +[Chef] is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. #### Chef resources for PHP developers: @@ -49,6 +47,8 @@ just deploy your app but can build your whole server environment or virtual boxe #### Further reading: * [Automate your project with Apache Ant][apache_ant_tutorial] +* [Expert PHP Deployments][expert_php_deployments] - free book on deployment with Capistrano, Phing and Vagrant. +* [Deploying PHP Applications][deploying_php_applications] - paid book on best practices and tools for PHP deployment. ### Continuous Integration @@ -76,6 +76,7 @@ PHP. [Apache Ant]: http://ant.apache.org/ [Capistrano]: https://github.com/capistrano/capistrano/wiki [phpdeploy_capistrano]: http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/ +[phpdeploy_deployer]: http://www.sitepoint.com/deploying-php-applications-with-deployer/ [Chef]: https://www.chef.io/ [chef_vagrant_and_ec2]: http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/ [Chef_cookbook]: https://github.com/chef-cookbooks/php @@ -85,4 +86,8 @@ PHP. [Jenkins]: http://jenkins-ci.org/ [PHPCI]: http://www.phptesting.org/ [Teamcity]: http://www.jetbrains.com/teamcity/ -[Deployer]: https://github.com/deployphp/deployer +[Deployer]: http://deployer.org/ +[Rocketeer]: http://rocketeer.autopergamene.eu/ +[Magallanes]: http://magephp.com/ +[expert_php_deployments]: http://viccherubini.com/assets/Expert-PHP-Deployments.pdf +[deploying_php_applications]: http://www.deployingphpapplications.com \ No newline at end of file From e7f12c40790b0990d4a1957a5c84b43a5d4a667f Mon Sep 17 00:00:00 2001 From: Niklas Modess Date: Tue, 26 Apr 2016 10:25:31 +0800 Subject: [PATCH 012/127] separate section for server provisioning and added ansible & puppet --- _posts/12-05-01-Building-your-Application.md | 34 ++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index b3b52bc..0cb5106 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -36,20 +36,31 @@ There are many open source tools available to help you with build automation and [Magallanes] another tool written in PHP with simple configuration done in YAML files. It has support for multiple servers and environments, atomic deployment, and have some built in tasks that you can leverage for common tools and frameworks. -[Chef] is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. - -#### Chef resources for PHP developers: - -* [Three part blog series about deploying a LAMP application with Chef, Vagrant, and EC2][chef_vagrant_and_ec2] -* [Chef Cookbook which installs and configures PHP and the PEAR package management system][Chef_cookbook] -* [Chef video tutorial series][Chef_tutorial] - #### Further reading: * [Automate your project with Apache Ant][apache_ant_tutorial] * [Expert PHP Deployments][expert_php_deployments] - free book on deployment with Capistrano, Phing and Vagrant. * [Deploying PHP Applications][deploying_php_applications] - paid book on best practices and tools for PHP deployment. +### Server Provisioning + +Managing and configuring servers can be a daunting task when faced with many servers. There are tools for dealing with this so you can automate your infrastructure to make sure you have the right servers and that they're configured properly. They often integrate with the larger cloud hosting providers (Amazon Web Services, Heroku, DigitalOcean, etc) for managing instances, which makes scaling an application a lot easier. + +[Ansible] is a tool that manages your infrastructure through YAML files. It's simple to get started with and can manage complex and large scale applications. There is an API for managing cloud instances and it can manage them through a dynamic inventory using certain tools. + +[Puppet] is a tool that has its own language and file types for managing servers and configurations. It can be used in a master/client setup or it can be used in a "master-less" mode. In the master/client mode the clients will poll the central master(s) for new configuration on set intervals and update itself if necessary. In the master-less mode you can push changes to your nodes. + +[Chef] is a powerful Ruby based system integration framework that you can build your whole server environment or virtual boxes with. It integrates well with Amazon Web Services through their service called OpsWorks. + +#### Further reading: + +* [An Ansible Tutorial][an_ansible_tutorial] +* [Ansible for DevOps][ansible_for_devops] - paid book on everything Ansible +* [Ansible for AWS][ansible_for_aws] - paid book on integrating Ansible and Amazon Web Services +* [Three part blog series about deploying a LAMP application with Chef, Vagrant, and EC2][chef_vagrant_and_ec2] +* [Chef Cookbook which installs and configures PHP and the PEAR package management system][Chef_cookbook] +* [Chef video tutorial series][Chef_tutorial] + ### Continuous Integration > Continuous Integration is a software development practice where members of a team integrate their work frequently, @@ -90,4 +101,9 @@ PHP. [Rocketeer]: http://rocketeer.autopergamene.eu/ [Magallanes]: http://magephp.com/ [expert_php_deployments]: http://viccherubini.com/assets/Expert-PHP-Deployments.pdf -[deploying_php_applications]: http://www.deployingphpapplications.com \ No newline at end of file +[deploying_php_applications]: http://www.deployingphpapplications.com +[Ansible]: https://www.ansible.com/ +[Puppet]: https://puppet.com/ +[ansible_for_devops]: https://leanpub.com/ansible-for-devops +[ansible_for_aws]: https://leanpub.com/ansible-for-aws +[an_ansible_tutorial]: https://serversforhackers.com/an-ansible-tutorial \ No newline at end of file From f626af3bd2a1c844d8a76976cf2ff7fd0b3b9f8a Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Fri, 27 May 2016 09:34:42 +0100 Subject: [PATCH 013/127] Remove line about phptools on ccirello's request. ccirello is a maintainer of phpfmt/php.tools - so if he doesn't want his project mentioned... --- _posts/02-01-01-Code-Style-Guide.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index cd77d03..9988cf7 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -32,7 +32,6 @@ editors like [Sublime Text 2][st-cs] to be given real time feedback. You can fix the code layout automatically by using one of the following tools: - One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. -- Another option is [php.tools][phptools], which is made popular by the [sublime-phpfmt][sublime-phpfmt] editor plugin. While being newer, it makes great improvements in performance, meaning real-time editor fixing is more fluid. - Also, the [PHP Code Beautifier and Fixer][phpcbf] tool which is included with PHP_CodeSniffer can be used to adjust your code accordingly. And you can run phpcs manually from shell: @@ -59,5 +58,4 @@ readable by all current and future parties who may be working on the codebase. [phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ -[phptools]: https://github.com/phpfmt/php.tools [sublime-phpfmt]: https://github.com/phpfmt/sublime-phpfmt From 44eada46435965e49cda537298e3229c7a17cb9f Mon Sep 17 00:00:00 2001 From: Ahmed Khan Date: Fri, 27 May 2016 17:05:49 +0500 Subject: [PATCH 014/127] Adding a new PaaS provider Cloudways --- _posts/16-05-01-PHP-PaaS-Providers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index c50dc16..27a5e2a 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -18,5 +18,6 @@ anchor: php_paas_providers * [Google App Engine](https://developers.google.com/appengine/docs/php/gettingstarted/) * [Jelastic](http://jelastic.com/) * [Platform.sh](https://platform.sh/) +* [Cloudways](https://www.cloudways.com/en/) To see which versions these PaaS hosts are running, head over to [PHP Versions](http://phpversions.info/paas-hosting/). From f7c15dcf912e47b5135b072c238e1adac6472a4e Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Mon, 30 May 2016 17:07:18 -0500 Subject: [PATCH 015/127] Correct spelling --- _posts/16-03-01-People-to-Follow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index 9f0e252..0ff15c4 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -5,7 +5,7 @@ anchor: people_to_follow ## People to Follow {#people_to_follow_title} -It's difficult to find interesting and knowledgable PHP +It's difficult to find interesting and knowledgeable PHP community members when you are first starting out. You can find a comprehensive list of PHP community members and their Twitter handles at: From 0c384c9801574dfd8276fb44900c26906cff1f2f Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Mon, 30 May 2016 17:14:22 -0500 Subject: [PATCH 016/127] Replace dead link for PHP developers to follow --- _posts/16-03-01-People-to-Follow.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index 0ff15c4..66488cf 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -10,4 +10,7 @@ community members when you are first starting out. You can find a comprehensive list of PHP community members and their Twitter handles at: - +* [25 PHP Developers to Follow Online][php-developers-to-follow] + + +[php-developers-to-follow]: https://blog.newrelic.com/2014/05/02/25-php-developers-follow-online/ From 09fce78cfac34ba298601e7421dbee860e729e8f Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Fri, 3 Jun 2016 19:32:48 -0500 Subject: [PATCH 017/127] Fix capitalization for "PHP" and "PaaS" --- _posts/08-03-01-Plain-PHP-Templates.md | 1 + _posts/16-05-01-PHP-PaaS-Providers.md | 1 + 2 files changed, 2 insertions(+) diff --git a/_posts/08-03-01-Plain-PHP-Templates.md b/_posts/08-03-01-Plain-PHP-Templates.md index 7d08069..78bcf05 100644 --- a/_posts/08-03-01-Plain-PHP-Templates.md +++ b/_posts/08-03-01-Plain-PHP-Templates.md @@ -1,4 +1,5 @@ --- +title: Plain PHP Templates isChild: true anchor: plain_php_templates --- diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 27a5e2a..57f3f57 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -1,4 +1,5 @@ --- +title: PHP PaaS Providers isChild: true anchor: php_paas_providers --- From 61b2875a2be40c31e90492703953924735921907 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 8 Jun 2016 10:20:24 -0400 Subject: [PATCH 018/127] Added Minimum Viable Tests book Also updated my URL. Some folks like dead trees. --- _posts/16-10-01-Books.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index a14d435..29aa99c 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -21,7 +21,7 @@ for modern, secure, and fast cryptography. ### Paid Books -* [Build APIs You Won't Hate](https://leanpub.com/build-apis-you-wont-hate) - Everyone and their dog wants an API, +* [Build APIs You Won't Hate](https://apisyouwonthate.com/) - Everyone and their dog wants an API, so you should probably learn how to build them. * [Building Secure PHP Apps](https://leanpub.com/buildingsecurephpapps) - Learn the security basics that a senior developer usually acquires over years of experience, all condensed down into one quick and easy handbook @@ -33,4 +33,5 @@ security terms and provides some examples of them in every day PHP * [Signaling PHP](https://leanpub.com/signalingphp) - PCNLT signals are a great help when writing PHP scripts that run from the command line. * [The Grumpy Programmer's Guide To Building Testable PHP Applications](https://leanpub.com/grumpy-testing) - Learning -to write testable code doesn't have to suck +to write testable code doesn't have to suck. +* [Minimum Viable Tests]() - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started. From f29afa9e81ba06890fe97c98c64bc90a76c690fd Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 8 Jun 2016 10:20:34 -0400 Subject: [PATCH 019/127] Update 16-10-01-Books.md --- _posts/16-10-01-Books.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index 29aa99c..5971e5f 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -34,4 +34,4 @@ security terms and provides some examples of them in every day PHP run from the command line. * [The Grumpy Programmer's Guide To Building Testable PHP Applications](https://leanpub.com/grumpy-testing) - Learning to write testable code doesn't have to suck. -* [Minimum Viable Tests]() - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started. +* [Minimum Viable Tests](https://leanpub.com/minimumviabletests) - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started. From 6581312ed65284a3f7c63f65954266d2b6b057c7 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 20 Jun 2016 17:35:28 -0400 Subject: [PATCH 020/127] Link to "new" location of PSRs --- _posts/02-01-01-Code-Style-Guide.md | 10 +++++----- _posts/03-03-01-Namespaces.md | 8 ++++---- _posts/07-05-01-Abstraction-Layers.md | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 4a3a7cb..50560c3 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -29,7 +29,7 @@ applications that implement the components can have consistency even when workin You can use [PHP_CodeSniffer][phpcs] to check code against any one of these recommendations, and plugins for text editors like [Sublime Text 2][st-cs] to be given real time feedback. -You can fix the code layout automatically by using one of the two following tools. One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. +You can fix the code layout automatically by using one of the two following tools. One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. Another option is [php.tools][phptools], which is made popular by the [sublime-phpfmt][sublime-phpfmt] editor plugin. While being newer, it makes great improvements in performance, meaning real-time editor fixing is more fluid. And you can run phpcs manually from shell: @@ -46,10 +46,10 @@ readable by all current and future parties who may be working on the codebase. [fig]: http://www.php-fig.org/ -[psr0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md -[psr1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md -[psr2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md -[psr4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md +[psr0]: http://www.php-fig.org/psr/psr-0/ +[psr1]: http://www.php-fig.org/psr/psr-1/ +[psr2]: http://www.php-fig.org/psr/psr-2/ +[psr4]: http://www.php-fig.org/psr/psr-4/ [pear-cs]: http://pear.php.net/manual/en/standards.php [symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index 4c81d7d..55030aa 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -21,10 +21,10 @@ namespace convention to allow plug-and-play code. In October 2014 the PHP-FIG deprecated the previous autoloading standard: [PSR-0][psr0], which has been replaced with [PSR-4][psr4]. Currently both are still perfectly usable and PSR-0 is not going away. As PSR-4 requires PHP 5.3 and -many PHP 5.2-only projects currently implement PSR-0. Luckily those PHP 5.2-only projects are starting to up their +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] @@ -33,5 +33,5 @@ to look into PSR-4. [namespaces]: http://php.net/language.namespaces -[psr0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md -[psr4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md +[psr0]: http://www.php-fig.org/psr/psr-0/ +[psr4]: http://www.php-fig.org/psr/psr-4/ diff --git a/_posts/07-05-01-Abstraction-Layers.md b/_posts/07-05-01-Abstraction-Layers.md index 718ee0a..392bf44 100644 --- a/_posts/07-05-01-Abstraction-Layers.md +++ b/_posts/07-05-01-Abstraction-Layers.md @@ -26,5 +26,5 @@ installed in any application you like: [4]: http://packages.zendframework.com/docs/latest/manual/en/index.html#zend-db [6]: https://github.com/auraphp/Aura.Sql [7]: http://propelorm.org/ -[psr0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md -[psr4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md +[psr0]: http://www.php-fig.org/psr/psr-0/ +[psr4]: http://www.php-fig.org/psr/psr-4/ From aa2071811e70b58d4f619e94a9d489f8223452dd Mon Sep 17 00:00:00 2001 From: Martin Joiner Date: Thu, 30 Jun 2016 12:42:04 +0100 Subject: [PATCH 021/127] XDebug.md: Corrected syntax (removed equals operator) in VHost snippet --- _posts/03-06-01-XDebug.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/03-06-01-XDebug.md b/_posts/03-06-01-XDebug.md index 9d35a27..e5de055 100644 --- a/_posts/03-06-01-XDebug.md +++ b/_posts/03-06-01-XDebug.md @@ -21,8 +21,8 @@ will want to enable right away. Traditionally, you will modify your Apache VHost or .htaccess file with these values: {% highlight ini %} -php_value xdebug.remote_host=192.168.?.? -php_value xdebug.remote_port=9000 +php_value xdebug.remote_host 192.168.?.? +php_value xdebug.remote_port 9000 {% endhighlight %} The "remote host" and "remote port" will correspond to your local computer and the port that you configure your IDE to From 09a16031f4fabc49aba34e9a33ce8d0e6df4c371 Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Fri, 3 Jun 2016 19:32:48 -0500 Subject: [PATCH 022/127] Fix capitalization for "PHP" and "PaaS" --- _posts/08-03-01-Plain-PHP-Templates.md | 1 + _posts/16-05-01-PHP-PaaS-Providers.md | 1 + 2 files changed, 2 insertions(+) diff --git a/_posts/08-03-01-Plain-PHP-Templates.md b/_posts/08-03-01-Plain-PHP-Templates.md index 7d08069..78bcf05 100644 --- a/_posts/08-03-01-Plain-PHP-Templates.md +++ b/_posts/08-03-01-Plain-PHP-Templates.md @@ -1,4 +1,5 @@ --- +title: Plain PHP Templates isChild: true anchor: plain_php_templates --- diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 27a5e2a..57f3f57 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -1,4 +1,5 @@ --- +title: PHP PaaS Providers isChild: true anchor: php_paas_providers --- From c5ecf32775de9402e56f2123ca798fd2f8fbdd69 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Delhommeau Date: Mon, 4 Jul 2016 13:36:59 +0200 Subject: [PATCH 023/127] style: Improve render of example code --- less/all.less | 5 +++++ styles/syntax.css | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/less/all.less b/less/all.less index 4ecc4c8..744e501 100644 --- a/less/all.less +++ b/less/all.less @@ -139,6 +139,11 @@ pre{ pre{ padding: 5px 10px; + white-space: pre-wrap; + white-space: -moz-pre-wrap; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word; } } diff --git a/styles/syntax.css b/styles/syntax.css index 1e651cf..f65ef4c 100644 --- a/styles/syntax.css +++ b/styles/syntax.css @@ -1,4 +1,4 @@ -.highlight { background: #ffffff; } +.highlight { background: #ffffff; margin: 0 4px; font-size: 0.8em; } .highlight .c { color: #999988; font-style: italic } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { font-weight: bold } /* Keyword */ From 3ef7f9aa6b7da7cd55128717ea2dcf3b8234348e Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Tue, 5 Jul 2016 23:22:59 -0500 Subject: [PATCH 024/127] Update the URL for php mentoring organization --- _posts/16-04-01-Mentoring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/16-04-01-Mentoring.md b/_posts/16-04-01-Mentoring.md index 1d7ddc1..788553c 100644 --- a/_posts/16-04-01-Mentoring.md +++ b/_posts/16-04-01-Mentoring.md @@ -5,4 +5,4 @@ anchor: mentoring ## Mentoring {#mentoring_title} -* [phpmentoring.org](http://phpmentoring.org/) - Formal, peer to peer mentoring in the PHP community. +* [php-mentoring.org](http://php-mentoring.org/) - Formal, peer to peer mentoring in the PHP community. From ced0fbcb203b582989ffe16dec91fda58a1088f0 Mon Sep 17 00:00:00 2001 From: Naveen Valecha Date: Mon, 11 Jul 2016 09:37:51 +0530 Subject: [PATCH 025/127] Remove the another option thing out of Code Style Guide due to dead links. --- _posts/02-01-01-Code-Style-Guide.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 50560c3..a8d637a 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -30,7 +30,6 @@ You can use [PHP_CodeSniffer][phpcs] to check code against any one of these reco editors like [Sublime Text 2][st-cs] to be given real time feedback. You can fix the code layout automatically by using one of the two following tools. One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. -Another option is [php.tools][phptools], which is made popular by the [sublime-phpfmt][sublime-phpfmt] editor plugin. While being newer, it makes great improvements in performance, meaning real-time editor fixing is more fluid. And you can run phpcs manually from shell: @@ -55,5 +54,3 @@ readable by all current and future parties who may be working on the codebase. [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ -[phptools]: https://github.com/phpfmt/php.tools -[sublime-phpfmt]: https://github.com/phpfmt/sublime-phpfmt From 859d12bbc47f0d55359154c1aa062a7ccb5c704c Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Wed, 13 Jul 2016 15:20:02 -0500 Subject: [PATCH 026/127] Add text and examples for phpcbf and php-cs-fixer --- _posts/02-01-01-Code-Style-Guide.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index a8d637a..1c0818f 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -27,18 +27,26 @@ applications that implement the components can have consistency even when workin * [Read about Symfony Coding Standards][symfony-cs] You can use [PHP_CodeSniffer][phpcs] to check code against any one of these recommendations, and plugins for text -editors like [Sublime Text 2][st-cs] to be given real time feedback. +editors like [Sublime Text 2][st-cs] to be given real-time feedback. -You can fix the code layout automatically by using one of the two following tools. One is the [PHP Coding Standards Fixer][phpcsfixer] which has a very well tested codebase. - -And you can run phpcs manually from shell: +You can run PHP_CodeSniffer manually from the shell: phpcs -sw --standard=PSR2 file.php -It will show errors and descriptions how to fix them. +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 violations have been fixed. +That way, branches 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 +[PHP Code Beautifier and Fixer][phpcbf]. + + phpcbf -w --standard=PSR2 file.php + +Another option is to use the [PHP Coding Standards Fixer][phpcsfixer], which has a very well tested codebase. It will +show which kind of errors the code structure had before it fixed them. + + php-cs-fixer fix -v --level=psr2 file.php English is preferred for all symbol names and code infrastructure. Comments may be written in any language easily readable by all current and future parties who may be working on the codebase. @@ -52,5 +60,6 @@ readable by all current and future parties who may be working on the codebase. [pear-cs]: http://pear.php.net/manual/en/standards.php [symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ +[phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ From 36b8c669f0dcc4384eb27a59198e3d7bc5d8a725 Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Wed, 13 Jul 2016 23:59:44 -0500 Subject: [PATCH 027/127] Fix jeckyll serve command --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6168c8..2d13345 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,7 +68,7 @@ included in the project: # Install the needed gems through Bundler bundle install # Run the local server - bundle execute jekyll s + bundle exec jekyll serve ``` 5. Commit your changes in logical chunks. Please adhere to these [git commit From 7d94b0f83c3651d7cb4f19ac68b556a196bba1e6 Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko Date: Sat, 16 Jul 2016 12:34:11 +0300 Subject: [PATCH 028/127] Update The-Basics.md Comment "Strict comparisons" over "equality comparisons" code example make confusing. --- pages/The-Basics.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pages/The-Basics.md b/pages/The-Basics.md index 97359d4..ec1798c 100644 --- a/pages/The-Basics.md +++ b/pages/The-Basics.md @@ -20,15 +20,12 @@ var_dump($a == '5'); // compare value (ignore type); return true var_dump($a === 5); // compare type/value (integer vs. integer); return true var_dump($a === '5'); // compare type/value (integer vs. string); return false -/** - * Strict comparisons - */ +//Equality comparisons if (strpos('testing', 'test')) { // 'test' is found at position 0, which is interpreted as the boolean 'false' // code... } -// vs. - +// vs. strict comparisons if (strpos('testing', 'test') !== false) { // true, as strict comparison was made (0 !== false) // code... } From ed0063cafdc905033f17c049f3cf02fb607c9657 Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko Date: Sat, 16 Jul 2016 12:38:35 +0300 Subject: [PATCH 029/127] Update The-Basics.md if/else statements can't be used inside class definition, just inside class methods. This may confuse beginners. --- pages/The-Basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/The-Basics.md b/pages/The-Basics.md index 97359d4..5e0bab9 100644 --- a/pages/The-Basics.md +++ b/pages/The-Basics.md @@ -42,7 +42,7 @@ if (strpos('testing', 'test') !== false) { // true, as strict comparison was ### If statements -While using 'if/else' statements within a function or class, there is a common misconception that 'else' must be used +While using 'if/else' statements within a function or class method, there is a common misconception that 'else' must be used in conjunction to declare potential outcomes. However if the outcome is to define the return value, 'else' is not necessary as 'return' will end the function, causing 'else' to become moot. From 470cb1e571c63209664d5781a959ee6757c2d1a7 Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Sat, 16 Jul 2016 14:05:12 -0500 Subject: [PATCH 030/127] Remove awkward clause. The phrase about how well tested this library is seems out of place for a library that is compared to others in the same section. One would assume that that all of these are well tested. --- _posts/02-01-01-Code-Style-Guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 1c0818f..55c1159 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -43,8 +43,8 @@ If you have PHP_CodeSniffer, then you can fix the code layout problems reported phpcbf -w --standard=PSR2 file.php -Another option is to use the [PHP Coding Standards Fixer][phpcsfixer], which has a very well tested codebase. It will -show which kind of errors the code structure had before it fixed them. +Another option is to use the [PHP Coding Standards Fixer][phpcsfixer]. +It will show which kind of errors the code structure had before it fixed them. php-cs-fixer fix -v --level=psr2 file.php From 8403a61b695f0a59b57d81db86c130566a49a510 Mon Sep 17 00:00:00 2001 From: remocrevo Date: Thu, 4 Aug 2016 09:58:16 -0400 Subject: [PATCH 031/127] Update Zend-db name and link The anchor name for the Zend-db package has changed. This commit updates the link. It also changes the name to simply "Zend-db", which seems to be the new official name. --- _posts/07-05-01-Abstraction-Layers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/07-05-01-Abstraction-Layers.md b/_posts/07-05-01-Abstraction-Layers.md index 392bf44..8df5ef2 100644 --- a/_posts/07-05-01-Abstraction-Layers.md +++ b/_posts/07-05-01-Abstraction-Layers.md @@ -18,12 +18,12 @@ installed in any application you like: * [Aura SQL][6] * [Doctrine2 DBAL][2] * [Propel][7] -* [ZF2 Db][4] +* [Zend-db][4] [1]: http://php.net/book.pdo [2]: http://www.doctrine-project.org/projects/dbal.html -[4]: http://packages.zendframework.com/docs/latest/manual/en/index.html#zend-db +[4]: https://packages.zendframework.com/docs/latest/manual/en/index.html#zendframework/zend-db [6]: https://github.com/auraphp/Aura.Sql [7]: http://propelorm.org/ [psr0]: http://www.php-fig.org/psr/psr-0/ From 84a02e988188b7b5f038b8b1b726c67bfb09ee22 Mon Sep 17 00:00:00 2001 From: ArthurH Date: Wed, 31 Aug 2016 11:19:34 +0200 Subject: [PATCH 032/127] Add new PaaS Provider I added 2 paas provider in the list which are running under [Cloud Foundry](https://www.cloudfoundry.org/). Bluemix is in the list of http://phpversions.info but it's not up to date and pivotal web service is not. I will do a PR to update http://phpversions.info --- _posts/16-05-01-PHP-PaaS-Providers.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 57f3f57..ee4e06d 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -20,5 +20,7 @@ anchor: php_paas_providers * [Jelastic](http://jelastic.com/) * [Platform.sh](https://platform.sh/) * [Cloudways](https://www.cloudways.com/en/) +* [IBM Bluemix Cloud Foundry](https://console.ng.bluemix.net/) +* [Pivotal Web Service Cloud Foundry](https://run.pivotal.io/) To see which versions these PaaS hosts are running, head over to [PHP Versions](http://phpversions.info/paas-hosting/). From 14e80864d583bfcc0bcefa7d11ac0c7a60aecc70 Mon Sep 17 00:00:00 2001 From: Myo T Kyaw Date: Fri, 16 Sep 2016 18:40:43 -0700 Subject: [PATCH 033/127] Update with minor grammar fixes --- _posts/01-04-01-Mac-Setup.md | 6 +++--- _posts/01-05-01-Windows-Setup.md | 4 ++-- _posts/03-03-01-Namespaces.md | 2 +- _posts/04-02-01-Composer-and-Packagist.md | 4 ++-- _posts/04-03-01-PEAR.md | 2 +- _posts/05-02-01-The-Basics.md | 2 +- _posts/05-05-01-PHP-and-UTF8.md | 2 +- _posts/06-03-01-Complex-Problem.md | 2 +- _posts/07-04-01-Interacting-via-Code.md | 2 +- _posts/10-03-01-Password-Hashing.md | 4 ++-- _posts/10-05-01-Configuration-Files.md | 2 +- _posts/12-04-01-Shared-Servers.md | 2 +- _posts/16-09-01-Videos.md | 2 +- _posts/17-02-01-User-Groups.md | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index c496f25..16e015d 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -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 diff --git a/_posts/01-05-01-Windows-Setup.md b/_posts/01-05-01-Windows-Setup.md index e916c91..1435ed7 100644 --- a/_posts/01-05-01-Windows-Setup.md +++ b/_posts/01-05-01-Windows-Setup.md @@ -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. diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index 55030aa..dc6084e 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -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] diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index 553e57f..10e1f6f 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -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. diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index 3c9af2a..997586d 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -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 diff --git a/_posts/05-02-01-The-Basics.md b/_posts/05-02-01-The-Basics.md index 458c670..dd5fc28 100644 --- a/_posts/05-02-01-The-Basics.md +++ b/_posts/05-02-01-The-Basics.md @@ -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. diff --git a/_posts/05-05-01-PHP-and-UTF8.md b/_posts/05-05-01-PHP-and-UTF8.md index de0d659..b734d3b 100644 --- a/_posts/05-05-01-PHP-and-UTF8.md +++ b/_posts/05-05-01-PHP-and-UTF8.md @@ -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. diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md index 0d6f907..c64e723 100644 --- a/_posts/06-03-01-Complex-Problem.md +++ b/_posts/06-03-01-Complex-Problem.md @@ -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. diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index 78d4f4b..5cae4f0 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -19,7 +19,7 @@ foreach ($db->query('SELECT * FROM table') as $row) { {% 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 diff --git a/_posts/10-03-01-Password-Hashing.md b/_posts/10-03-01-Password-Hashing.md index ee70a65..d1694e6 100644 --- a/_posts/10-03-01-Password-Hashing.md +++ b/_posts/10-03-01-Password-Hashing.md @@ -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 diff --git a/_posts/10-05-01-Configuration-Files.md b/_posts/10-05-01-Configuration-Files.md index afb7c0b..2e30846 100644 --- a/_posts/10-05-01-Configuration-Files.md +++ b/_posts/10-05-01-Configuration-Files.md @@ -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. diff --git a/_posts/12-04-01-Shared-Servers.md b/_posts/12-04-01-Shared-Servers.md index f33127a..828eb4f 100644 --- a/_posts/12-04-01-Shared-Servers.md +++ b/_posts/12-04-01-Shared-Servers.md @@ -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/). diff --git a/_posts/16-09-01-Videos.md b/_posts/16-09-01-Videos.md index 35e961b..7cdbd6f 100644 --- a/_posts/16-09-01-Videos.md +++ b/_posts/16-09-01-Videos.md @@ -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) diff --git a/_posts/17-02-01-User-Groups.md b/_posts/17-02-01-User-Groups.md index 97c062b..7fcd668 100644 --- a/_posts/17-02-01-User-Groups.md +++ b/_posts/17-02-01-User-Groups.md @@ -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 From c672506e4fa395496a2db77e873958ba8e2578ee Mon Sep 17 00:00:00 2001 From: Myo T Kyaw Date: Sat, 17 Sep 2016 10:06:51 -0700 Subject: [PATCH 034/127] Correct wrong fix for _posts/04-03-01-PEAR.md:60 --- _posts/04-03-01-PEAR.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index 997586d..3c9af2a 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -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 required section will prefix the package name like this: +terminology) the pear repo. Then the require section will prefix the package name like this: > pear-channel/Package From 246d08a5389f8f195601d87f87891f307f906a45 Mon Sep 17 00:00:00 2001 From: Myo T Kyaw Date: Sat, 17 Sep 2016 23:20:10 -0700 Subject: [PATCH 035/127] Put backticks for 'require' in _posts/04-03-01-PEAR.md:60 --- _posts/04-03-01-PEAR.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index 3c9af2a..f61a3e6 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -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 `require` section will prefix the package name like this: > pear-channel/Package From 09083ac64189d23d010c6871847d8771aa9cb562 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Wed, 28 Sep 2016 21:44:08 +0100 Subject: [PATCH 036/127] Composer - safer download, installation - The official instructions are less risky than what we have now as they include an SHA check. - Encourage people a little more strongly to install globally. - Improved explanation of .phar archives. --- _posts/04-02-01-Composer-and-Packagist.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index 553e57f..30bc63b 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -14,21 +14,19 @@ There are already a lot of PHP libraries that are compatible with Composer, read ### How to Install Composer -You can install Composer locally (in your current working directory) or globally (e.g. /usr/local/bin, recommended). -Let's assume you want to install Composer globally: +The safest way to download composer is by [following the official instructions](https://getcomposer.org/download/). +This will verify the installer is not corrupt or tampered with. +The installer installs Composer *locally*, in your current working directory. + +We recommend installing it *globally* (e.g. a single copy in /usr/local/bin) – to do so, run this afterwards: {% highlight console %} -curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer {% endhighlight %} -**Note:** If the above fails due to permissions, run the `mv` line again with `sudo`. +**Note:** If the above fails due to permissions, prefix with `sudo`. -This will download `composer.phar` (a PHP binary archive). You can run this with `php` to manage your project -dependencies. - -**Please Note:** If you pipe downloaded code directly into an interpreter, please read the -code online first to confirm it is safe. +`composer.phar` is a PHP [binary archive](http://php.net/manual/en/intro.phar.php). Like any PHP application, you can [run these](http://php.net/manual/en/phar.using.intro.php) with `php`. #### Installing on Windows From 9c3a17d0244b683dcf4acec3092d383def6ec607 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Wed, 28 Sep 2016 21:56:25 +0100 Subject: [PATCH 037/127] Code Style Guide - project list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Be bolder (some -> many) - How can we not have Laravel… --- _posts/02-01-01-Code-Style-Guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 9182cee..3365509 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -11,8 +11,8 @@ their projects. The [Framework Interop Group][fig] has proposed and approved a series of style recommendations. Not all of them related to code-style, but those that do are [PSR-0][psr0], [PSR-1][psr1], [PSR-2][psr2] and [PSR-4][psr4]. These -recommendations are merely a set of rules that some projects like Drupal, Zend, Symfony, CakePHP, phpBB, AWS SDK, -FuelPHP, Lithium, etc are starting to adopt. You can use them for your own projects, or continue to use your own +recommendations are merely a set of rules that many projects like Drupal, Zend, Symfony, Laravel, CakePHP, phpBB, AWS SDK, +FuelPHP, Lithium, etc are adopting. You can use them for your own projects, or continue to use your own personal style. Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one From 9247b932edfd4cb14b58b1b56f3db7bb6467bb17 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 29 Sep 2016 12:02:23 +0100 Subject: [PATCH 038/127] Use current Stable version - link End of Life cal --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b6a2a57..d2994c0 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -9,7 +9,7 @@ anchor: use_the_current_stable_version If you are getting started with PHP, start with the current stable release of [PHP 7.0][php-release]. PHP 7.0 is very new, and adds many amazing [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. -Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly. Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php70-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. +Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php70-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. [php-release]: http://php.net/downloads.php [php-docs]: http://php.net/manual/ From ad10a9a6afc14feff85d1eb2aa82b09ee93f84c5 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 29 Sep 2016 12:13:19 +0100 Subject: [PATCH 039/127] Mac Setup - update bundled PHP version Add macOS Sierra (10.12) --- _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 c496f25..0476dd9 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -6,7 +6,7 @@ anchor: mac_setup ## Mac Setup {#mac_setup_title} OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mavericks has 5.4.17, -Yosemite has 5.5.9 and El Capitan has 5.5.29, but with PHP 7.0 out that is often not good enough. +Yosemite 5.5.9, El Capitan 5.5.29 and Sierra 5.6.24, but with PHP 7.0 out that is often not good enough. There are multiple ways to install PHP on OS X. From 625d90085155925aa7b9b4175843e6561038387e Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 29 Sep 2016 12:35:10 +0100 Subject: [PATCH 040/127] Namespaces - simplify, add clarity --- _posts/03-03-01-Namespaces.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index 55030aa..0536eed 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -6,7 +6,7 @@ anchor: namespaces ## Namespaces {#namespaces_title} As mentioned above, the PHP community has a lot of developers creating lots of code. This means that one library's PHP -code may use the same class name as another library. When both libraries are used in the same namespace, they collide +code might use the same class name as another. When both libraries are used in the same namespace, they collide and cause trouble. _Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared to operating @@ -19,13 +19,9 @@ with other libraries. One recommended way to use namespaces is outlined in [PSR-4][psr4], which aims to provide a standard file, class and namespace convention to allow plug-and-play code. -In October 2014 the PHP-FIG deprecated the previous autoloading standard: [PSR-0][psr0], which has been replaced with -[PSR-4][psr4]. Currently both are still perfectly usable and PSR-0 is not going away. As PSR-4 requires PHP 5.3 and -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. +In October 2014 the PHP-FIG deprecated the previous autoloading standard: [PSR-0][psr0]. Both PSR-0 and PSR-4 are still perfectly usable. The latter requires PHP 5.3, so many PHP 5.2-only projects implement PSR-0. -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. +If you're going to use an autoloader standard for a new application or package, look into PSR-4. * [Read about Namespaces][namespaces] * [Read about PSR-0][psr0] From 12c37951ef82491e7d7310c4072465249fdea426 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 29 Sep 2016 13:38:51 +0100 Subject: [PATCH 041/127] Date and Time - talk about Carbon --- _posts/05-03-01-Date-and-Time.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_posts/05-03-01-Date-and-Time.md b/_posts/05-03-01-Date-and-Time.md index 93f043a..8c826c0 100644 --- a/_posts/05-03-01-Date-and-Time.md +++ b/_posts/05-03-01-Date-and-Time.md @@ -60,6 +60,8 @@ foreach ($periodIterator as $date) { } {% endhighlight %} +A popular PHP API extension is [Carbon](http://carbon.nesbot.com). It inherits everything in the DateTime class, so involves minimal code alterations, but extra features include Localization support, further ways to add, subtract and format a DateTime object, plus a means to test your code by simulating a date and time of your choosing. + * [Read about DateTime][datetime] * [Read about date formatting][dateformat] (accepted date format string options) From ed5686f8f0d6d4e0a0e0c0add7188c8a2942ded3 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 29 Sep 2016 15:49:22 +0100 Subject: [PATCH 042/127] Em-dash to hyphen, clarify composer command --- _posts/04-02-01-Composer-and-Packagist.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index 30bc63b..03f2a9e 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -18,7 +18,7 @@ The safest way to download composer is by [following the official instructions]( This will verify the installer is not corrupt or tampered with. The installer installs Composer *locally*, in your current working directory. -We recommend installing it *globally* (e.g. a single copy in /usr/local/bin) – to do so, run this afterwards: +We recommend installing it *globally* (e.g. a single copy in /usr/local/bin) - to do so, run this afterwards: {% highlight console %} mv composer.phar /usr/local/bin/composer @@ -26,7 +26,7 @@ mv composer.phar /usr/local/bin/composer **Note:** If the above fails due to permissions, prefix with `sudo`. -`composer.phar` is a PHP [binary archive](http://php.net/manual/en/intro.phar.php). Like any PHP application, you can [run these](http://php.net/manual/en/phar.using.intro.php) with `php`. +To run a locally installed Composer you'd use `php composer.phar`, globally it's simply `composer`. #### Installing on Windows From ccdbf97a4af2932f3f3510d33e07f8bcf47ca19e Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Wed, 5 Oct 2016 23:00:15 -0500 Subject: [PATCH 043/127] Link to easy-to-read Read The Docs version rather than github repo The Read The Docs version is a nicely formatted version of the github version. It pulls directly from github, so it is just as up-to-date, but has nicer formatting. --- pages/Design-Patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 2693ca3..0888d56 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -11,7 +11,7 @@ make your code easier to manage and easier for others to understand. * [Architectural pattern on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern) * [Software design pattern on Wikipedia](https://en.wikipedia.org/wiki/Software_design_pattern) -* [Collection of implementation examples](https://github.com/domnikl/DesignPatternsPHP) +* [Collection of implementation examples](http://designpatternsphp.readthedocs.io/en/latest/) ## Factory From 89e02f7ce7a12c718334e39092e8af8c09ab55da Mon Sep 17 00:00:00 2001 From: William Turrell Date: Thu, 6 Oct 2016 10:59:36 +0100 Subject: [PATCH 044/127] Password Hashing - explain salts - what they are - why they're needed - how password_hash/verify handle it all for you. --- _posts/10-03-01-Password-Hashing.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/_posts/10-03-01-Password-Hashing.md b/_posts/10-03-01-Password-Hashing.md index ee70a65..5711b54 100644 --- a/_posts/10-03-01-Password-Hashing.md +++ b/_posts/10-03-01-Password-Hashing.md @@ -12,8 +12,13 @@ It is important that you properly [_hash_][3] passwords before storing them. Pas 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 -for other services. Therefore, it is important to take security seriously. +unauthorized third-party, all user accounts are now compromised. + +Passwords should also be individually [_salted_][5] by adding a random string to each password before hashing. This prevents dictionary attacks and the use of 'rainbow tables' (a reverse list of crytographic hashes for common passwords.) + +Hashing and salting are vital as often users use the same password for multiple services and password quality can be poor. + +Fortunately, nowadays PHP makes this easy. **Hashing passwords with `password_hash`** @@ -37,10 +42,12 @@ if (password_verify('bad-password', $passwordHash)) { } {% endhighlight %} +password_hash() takes care of password salting for you. The salt is stored, along with the algorithm and "cost", as part of the hash. password_verify() extracts this to determine how to check the password, so you don't need a separate database field to store your salts. * [Learn about `password_hash()`] [1] * [`password_compat` for PHP >= 5.3.7 && < 5.5] [2] * [Learn about hashing in regards to cryptography] [3] +* [Learn about salts] [5] * [PHP `password_hash()` RFC] [4] @@ -48,3 +55,4 @@ if (password_verify('bad-password', $passwordHash)) { [2]: https://github.com/ircmaxell/password_compat [3]: http://en.wikipedia.org/wiki/Cryptographic_hash_function [4]: https://wiki.php.net/rfc/password_hash +[5]: https://en.wikipedia.org/wiki/Salt_(cryptography) From 646aae60a9f3b619c12624a573780fcf6f5e1c7d Mon Sep 17 00:00:00 2001 From: William Turrell Date: Sat, 8 Oct 2016 12:18:17 +0100 Subject: [PATCH 045/127] Conform to style guide Backticks for functions, double (") not single (') quotes --- _posts/10-03-01-Password-Hashing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/10-03-01-Password-Hashing.md b/_posts/10-03-01-Password-Hashing.md index 5711b54..1e4019d 100644 --- a/_posts/10-03-01-Password-Hashing.md +++ b/_posts/10-03-01-Password-Hashing.md @@ -14,7 +14,7 @@ reversed. This means you can compare a hash against another to determine if they 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. -Passwords should also be individually [_salted_][5] by adding a random string to each password before hashing. This prevents dictionary attacks and the use of 'rainbow tables' (a reverse list of crytographic hashes for common passwords.) +Passwords should also be individually [_salted_][5] by adding a random string to each password before hashing. This prevents dictionary attacks and the use of "rainbow tables" (a reverse list of crytographic hashes for common passwords.) Hashing and salting are vital as often users use the same password for multiple services and password quality can be poor. @@ -42,7 +42,7 @@ if (password_verify('bad-password', $passwordHash)) { } {% endhighlight %} -password_hash() takes care of password salting for you. The salt is stored, along with the algorithm and "cost", as part of the hash. password_verify() extracts this to determine how to check the password, so you don't need a separate database field to store your salts. +`password_hash()` takes care of password salting for you. The salt is stored, along with the algorithm and "cost", as part of the hash. `password_verify()` extracts this to determine how to check the password, so you don't need a separate database field to store your salts. * [Learn about `password_hash()`] [1] * [`password_compat` for PHP >= 5.3.7 && < 5.5] [2] From 2fbdec94921c7c5ec31718b471a726d70266a582 Mon Sep 17 00:00:00 2001 From: William Turrell Date: Sun, 9 Oct 2016 10:27:38 +0100 Subject: [PATCH 046/127] Reflect that PHP 7 is now here, add a book - update/tidy references to version numbers - think "Modern PHP" should be on the list (I didn't write it, so can suggest without any bias) --- _posts/16-10-01-Books.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index 5971e5f..bf3e5c3 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -5,9 +5,7 @@ anchor: books ## Books {#books_title} -There are a lot of books around for PHP but some are sadly now quite old and no longer contain accurate information. -There are even books published for "PHP 6" which does not exist, and will not now ever exist. The next major version of -PHP will be named "PHP 7" because of those books. +There are many PHP books; sadly some are now quite old and no longer accurate. In particular, avoid books on "PHP 6", a version that will now never exist. The next major release of PHP after 5.6 was "PHP 7", [partly because of this](https://wiki.php.net/rfc/php6). This section aims to be a living document for recommended books on PHP development in general. If you would like your book to be added, send a PR and it will be reviewed for relevancy. @@ -23,6 +21,7 @@ for modern, secure, and fast cryptography. * [Build APIs You Won't Hate](https://apisyouwonthate.com/) - Everyone and their dog wants an API, so you should probably learn how to build them. +* [Modern PHP](http://shop.oreilly.com/product/0636920033868.do) - covers modern PHP features, best practices, testing, tuning, deployment and setting up a dev environment. * [Building Secure PHP Apps](https://leanpub.com/buildingsecurephpapps) - Learn the security basics that a senior developer usually acquires over years of experience, all condensed down into one quick and easy handbook * [Modernizing Legacy Applications In PHP](https://leanpub.com/mlaphp) - Get your code under control in a series of From 24dfa328ecaac52977e9bf5af419ee8f1063a04c Mon Sep 17 00:00:00 2001 From: William Turrell Date: Sun, 9 Oct 2016 12:02:33 +0100 Subject: [PATCH 047/127] Improve Docker explanation - More of an overview / how it works - Explain in which circumstances it might be useful - Simplify the example container - Mention PHPDocker.io - Two links to Docker Hub, one with the official images - brief security warning --- _posts/13-03-01-Docker.md | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/_posts/13-03-01-Docker.md b/_posts/13-03-01-Docker.md index b013dc0..3d1a1e7 100644 --- a/_posts/13-03-01-Docker.md +++ b/_posts/13-03-01-Docker.md @@ -5,41 +5,36 @@ anchor: docker ## Docker {#docker_title} -Beside using Vagrant, another easy way to get a virtual development or production environment up and running is [Docker]. -Docker helps you to provide Linux containers for all kind of applications. -There are many helpful docker images which could provide you with other great services without the need to install -these services on your local machine, e.g. MySQL or PostgreSQL and a lot more. Have a look at the [Docker Hub Registry] -[docker-hub] to search a list of available pre-built containers, which you can then run and use in very few steps. +[Docker] is so called because it's all about containers. It's a lightweight alternative to a fully-fledged Vagrant VM. PHP's OOP is perhaps a helpful analogy to understanding it: think of Docker "images" as classes and "containers" as instances of them. For a typical LAMP application, you might have a web server container, another for the PHP-FPM process and a third for the MySQL server. Your project files - PHP, HTML, other assets, database contents – all remain on your host computer. You can create containers from the command line, or build a `docker-compose.yml` file that specifies which to use and how they communicate ("link") with one another. + +Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's on virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. ### Example: Running your PHP Applications in Docker -After you [installed docker][docker-install] on your machine, you can start an Apache with PHP support in one step. -The following command will download a fully functional Apache installation with the latest PHP version and provide the -directory `/path/to/your/php/files` at `http://localhost:8080`: +After [installing docker][docker-install] on your machine, you can start a web server with one command. +The following will download a fully functional Apache installation with the latest PHP version, map `/path/to/your/php/files` to the document root, which you can view at `http://localhost:8080`: {% highlight console %} docker run -d --name my-php-webserver -p 8080:80 -v /path/to/your/php/files:/var/www/html/ php:apache {% endhighlight %} -After running `docker run` your container is initialized and running. -If you would like to stop or start your container again, you can use the provided name attribute and simply run -`docker stop my-php-webserver` and `docker start my-php-webserver` without providing the above mentioned parameters -again. +This will initialize and launch your container. `-d` makes it runs in the background. To stop and start it, simply run `docker stop my-php-webserver` and `docker start my-php-webserver` (the other parameters are not needed again). ### Learn more about Docker -The commands mentioned above only show a quick way to run an Apache web server with PHP support but there are a lot -more things that you can do with Docker. One of the most important things for PHP developers will be linking your -web server to a database instance, for example. How this could be done is well described within the [Docker User Guide] -[docker-doc]. +The command above shows a quick way to run a basic server. There's much more you can do (and thousands of pre-built images in the [Docker Hub][docker-hub].) Take time to learn the terminology and read the [Docker User Guide][docker-doc] to get the most from it, and don't run random code you've downloaded without checking it's safe – unofficial images may not have the latest security patches. If in doubt, stick to the [official repositiories][docker-hub-official]. + +The [PHPDocker.io] site will auto-generate all the files you need for a fully-featured LAMP/LEMP stack, including your choice of PHP version and extensions. * [Docker Website][Docker] * [Docker Installation][docker-install] -* [Docker Images at the Docker Hub Registry][docker-hub] * [Docker User Guide][docker-doc] - +* [Docker Hub][docker-hub] +* [Docker Hub - official images][docker-hub-official] [Docker]: http://docker.com/ [docker-hub]: https://hub.docker.com/ +[docker-hub-official]: https://hub.docker.com/explore/ [docker-install]: https://docs.docker.com/installation/ [docker-doc]: https://docs.docker.com/userguide/ +[PHPDocker.io]: https://phpdocker.io/generator From ce95ad0ee96f636cd08eb093bcd9cbc44fadaf2e Mon Sep 17 00:00:00 2001 From: William Turrell Date: Sun, 9 Oct 2016 15:35:43 +0100 Subject: [PATCH 048/127] Clarify opcodes, cache names, PHP versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Explain what opcodes are - Clarify the cache will check if the source code has changed - How to verify cache is turned on - Clarify naming (Opcache vs Zend OPcache vs Optimizer+ – hope I've got this right) - fix missing PHP versions for APC in links (markdown problem) --- _posts/14-02-01-Opcode-Cache.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/_posts/14-02-01-Opcode-Cache.md b/_posts/14-02-01-Opcode-Cache.md index 063d54b..162cc2d 100644 --- a/_posts/14-02-01-Opcode-Cache.md +++ b/_posts/14-02-01-Opcode-Cache.md @@ -5,23 +5,18 @@ anchor: opcode_cache ## Opcode Cache {#opcode_cache_title} -When a PHP file is executed, under the hood it is first compiled to opcodes and, only then, the opcodes are executed. -If a PHP file is not modified, the opcodes will always be the same. This means that the compilation step is a waste of -CPU resources. +When a PHP file is executed, it must first be compiled into [opcodes](http://php.net/manual/en/internals2.opcodes.php) (machine language instructions for the CPU). If the source code is unchanged, the opcodes will be the same, so this compilation step becomes a waste of CPU resources. -This is where opcode caches come in. They prevent redundant compilation by storing opcodes in memory and reusing it on -successive calls. Setting up an opcode cache takes a matter of minutes, and your application will speed up -significantly. There's really no reason not to use it. +An opcode cache prevents redundant compilation by storing opcodes in memory and reusing them on successive calls. It will typically check signature or modification time of the file first, in case there have been any changes. -As of PHP 5.5, there is a built-in opcode cache called [OPcache][opcache-book]. It is also available for earlier -versions. +It's likely an opcode cache will make a significant speed improvement to your application. Since PHP 5.5 there is one built in - [Zend OPcache][opcache-book]. Depending on your PHP package/distribution, it's usually turned on by default - check [opcache.enable](http://php.net/manual/en/opcache.configuration.php#ini.opcache.enable) and the output of `phpinfo()` to make sure. For earlier versions there's a PECL extension. Read more about opcode caches: -* [OPcache][opcache-book] (built-in since PHP 5.5) -* [APC] (PHP 5.4 and earlier) +* [Zend OPcache][opcache-book] (bunded with PHP since 5.5) +* Zend OPcache (formerly known as Zend Optimizer+) is now [open source][Zend Optimizer+] +* [APC] - PHP 5.4 and earlier * [XCache] -* [Zend Optimizer+] (part of Zend Server package) * [WinCache] (extension for MS Windows Server) * [list of PHP accelerators on Wikipedia][PHP_accelerators] @@ -29,6 +24,6 @@ Read more about opcode caches: [opcache-book]: http://php.net/book.opcache [APC]: http://php.net/book.apc [XCache]: http://xcache.lighttpd.net/ -[Zend Optimizer+]: http://www.zend.com/en/products/zend_server +[Zend Optimizer+]: https://github.com/zendtech/ZendOptimizerPlus [WinCache]: http://www.iis.net/download/wincacheforphp [PHP_accelerators]: http://en.wikipedia.org/wiki/List_of_PHP_accelerators From 3ef02dca0d52f4deb5d2dd8780fc6eed6ca3fcac Mon Sep 17 00:00:00 2001 From: William Turrell Date: Mon, 10 Oct 2016 18:53:08 +0100 Subject: [PATCH 049/127] Fix typos --- _posts/13-03-01-Docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/13-03-01-Docker.md b/_posts/13-03-01-Docker.md index 3d1a1e7..3f4f8de 100644 --- a/_posts/13-03-01-Docker.md +++ b/_posts/13-03-01-Docker.md @@ -7,7 +7,7 @@ anchor: docker [Docker] is so called because it's all about containers. It's a lightweight alternative to a fully-fledged Vagrant VM. PHP's OOP is perhaps a helpful analogy to understanding it: think of Docker "images" as classes and "containers" as instances of them. For a typical LAMP application, you might have a web server container, another for the PHP-FPM process and a third for the MySQL server. Your project files - PHP, HTML, other assets, database contents – all remain on your host computer. You can create containers from the command line, or build a `docker-compose.yml` file that specifies which to use and how they communicate ("link") with one another. -Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's on virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. +Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's own virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. ### Example: Running your PHP Applications in Docker @@ -22,7 +22,7 @@ This will initialize and launch your container. `-d` makes it runs in the backgr ### Learn more about Docker -The command above shows a quick way to run a basic server. There's much more you can do (and thousands of pre-built images in the [Docker Hub][docker-hub].) Take time to learn the terminology and read the [Docker User Guide][docker-doc] to get the most from it, and don't run random code you've downloaded without checking it's safe – unofficial images may not have the latest security patches. If in doubt, stick to the [official repositiories][docker-hub-official]. +The command above shows a quick way to run a basic server. There's much more you can do (and thousands of pre-built images in the [Docker Hub][docker-hub]). Take time to learn the terminology and read the [Docker User Guide][docker-doc] to get the most from it, and don't run random code you've downloaded without checking it's safe – unofficial images may not have the latest security patches. If in doubt, stick to the [official repositiories][docker-hub-official]. The [PHPDocker.io] site will auto-generate all the files you need for a fully-featured LAMP/LEMP stack, including your choice of PHP version and extensions. From f6c3087e36adaea1c592d5b4022f08c84930635e Mon Sep 17 00:00:00 2001 From: William Turrell Date: Mon, 10 Oct 2016 23:26:05 +0100 Subject: [PATCH 050/127] Rewrite introductory paragraph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I may have made it more complicated than before… Might be case of deciding what to leave out (e.g. I've tried to explain distinction between images and containers and give a simple example where containers only do one thing – I was thoroughly confused when first searching the Docker Hub…) --- _posts/13-03-01-Docker.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_posts/13-03-01-Docker.md b/_posts/13-03-01-Docker.md index 3f4f8de..7292556 100644 --- a/_posts/13-03-01-Docker.md +++ b/_posts/13-03-01-Docker.md @@ -5,7 +5,11 @@ anchor: docker ## Docker {#docker_title} -[Docker] is so called because it's all about containers. It's a lightweight alternative to a fully-fledged Vagrant VM. PHP's OOP is perhaps a helpful analogy to understanding it: think of Docker "images" as classes and "containers" as instances of them. For a typical LAMP application, you might have a web server container, another for the PHP-FPM process and a third for the MySQL server. Your project files - PHP, HTML, other assets, database contents – all remain on your host computer. You can create containers from the command line, or build a `docker-compose.yml` file that specifies which to use and how they communicate ("link") with one another. +[Docker] - a lightweight alternative to a full virtual machine - is so called because it's all about "containers". A container is a building block which, in the simplest case, does one specific job, e.g. running a web server. An "image" is the package you use to build the container - Docker has a repository full of them. + +A typical LAMP application might have three containers: a web server, a PHP-FPM process and MySQL. As with shared folders in Vagrant, you can leave your application files where they are and tell Docker where to find them. + +You can generate containers from the command line (see example below) or, for ease of maintenance, build a `docker-compose.yml` file for your project specifying which to create and how they communicate with one another. Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's own virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. From cd09eb3755a610b81ae69570424a2f1004dd79f3 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Fri, 14 Oct 2016 13:54:50 +0200 Subject: [PATCH 051/127] Paas providers URL fixes - fix Google App Engine docs URL - PagodaBox has a new URL - fortrabbit https URL - Engine Yard Cloud has a different URL - OpenShift https URL - AWS https --- _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 ee4e06d..33db599 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -6,17 +6,17 @@ anchor: php_paas_providers ## PHP PaaS Providers {#php_paas_providers_title} -* [PagodaBox](https://pagodabox.com/) +* [PagodaBox](https://pagodabox.io/) * [AppFog](https://www.ctl.io/appfog/) * [Heroku](https://devcenter.heroku.com/categories/php) -* [fortrabbit](http://fortrabbit.com/) -* [Engine Yard Cloud](https://www.engineyard.com/products/cloud) -* [Red Hat OpenShift Platform](http://openshift.com) +* [fortrabbit](https://www.fortrabbit.com/) +* [Engine Yard Cloud](https://www.engineyard.com/features) +* [Red Hat OpenShift Platform](https://www.openshift.com/) * [dotCloud](https://www.dotcloud.com/dev-center/platform-documentation) -* [AWS Elastic Beanstalk](http://aws.amazon.com/elasticbeanstalk/) +* [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) * [cloudControl](https://www.cloudcontrol.com/) * [Windows Azure](http://www.windowsazure.com/) -* [Google App Engine](https://developers.google.com/appengine/docs/php/gettingstarted/) +* [Google App Engine](https://cloud.google.com/appengine/docs/php/) * [Jelastic](http://jelastic.com/) * [Platform.sh](https://platform.sh/) * [Cloudways](https://www.cloudways.com/en/) From e54b3a278b5d1605d53dc737a927be02349a63c3 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Fri, 14 Oct 2016 13:56:15 +0200 Subject: [PATCH 052/127] dotCloud ceased to exist in february 2016 http://www.theregister.co.uk/2016/01/22/dotcloud_shutdown/ --- _posts/16-05-01-PHP-PaaS-Providers.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 33db599..3b45bfb 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -12,7 +12,6 @@ anchor: php_paas_providers * [fortrabbit](https://www.fortrabbit.com/) * [Engine Yard Cloud](https://www.engineyard.com/features) * [Red Hat OpenShift Platform](https://www.openshift.com/) -* [dotCloud](https://www.dotcloud.com/dev-center/platform-documentation) * [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) * [cloudControl](https://www.cloudcontrol.com/) * [Windows Azure](http://www.windowsazure.com/) From a16dc8a80c5d93f83b955040edb147aa6daf373a Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Fri, 14 Oct 2016 14:03:24 +0200 Subject: [PATCH 053/127] CloudControl closed in february 2016 http://blog.scalingo.com/post/139422803483/cloudcontrol-is-shutting-down-time-to-migrate-to --- _posts/16-05-01-PHP-PaaS-Providers.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 3b45bfb..58d28f3 100644 --- a/_posts/16-05-01-PHP-PaaS-Providers.md +++ b/_posts/16-05-01-PHP-PaaS-Providers.md @@ -13,7 +13,6 @@ anchor: php_paas_providers * [Engine Yard Cloud](https://www.engineyard.com/features) * [Red Hat OpenShift Platform](https://www.openshift.com/) * [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) -* [cloudControl](https://www.cloudcontrol.com/) * [Windows Azure](http://www.windowsazure.com/) * [Google App Engine](https://cloud.google.com/appengine/docs/php/) * [Jelastic](http://jelastic.com/) From e4fa12422c5879ba7b0fcb9a9e0b55420edae1fe Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Wed, 19 Oct 2016 10:06:19 +0200 Subject: [PATCH 054/127] Fix headers capitalization If the title is not explicitly stated, it is generated from the filename. It does not work fine for: "and", "or", "the" which should not be capitalized. --- _posts/04-02-01-Composer-and-Packagist.md | 1 + _posts/04-03-01-PEAR.md | 1 + _posts/05-03-01-Date-and-Time.md | 1 + _posts/12-01-01-Servers-and-Deployment.md | 1 + _posts/12-03-01-Virtual-or-Dedicated-Servers.md | 3 ++- _posts/16-02-01-From-the-Source.md | 1 + _posts/16-03-01-People-to-Follow.md | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index 03f2a9e..d580acb 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -1,4 +1,5 @@ --- +title: Composer and Packagist isChild: true anchor: composer_and_packagist --- diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index 3c9af2a..ad30a35 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -1,4 +1,5 @@ --- +title: PEAR isChild: true anchor: pear --- diff --git a/_posts/05-03-01-Date-and-Time.md b/_posts/05-03-01-Date-and-Time.md index 8c826c0..c56781a 100644 --- a/_posts/05-03-01-Date-and-Time.md +++ b/_posts/05-03-01-Date-and-Time.md @@ -1,4 +1,5 @@ --- +title: Date and Time isChild: true anchor: date_and_time --- diff --git a/_posts/12-01-01-Servers-and-Deployment.md b/_posts/12-01-01-Servers-and-Deployment.md index f54a0e2..ea67099 100644 --- a/_posts/12-01-01-Servers-and-Deployment.md +++ b/_posts/12-01-01-Servers-and-Deployment.md @@ -1,4 +1,5 @@ --- +title: Servers and Deployment anchor: servers_and_deployment --- diff --git a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md index 322bdb6..1780ecf 100644 --- a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md +++ b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md @@ -1,4 +1,5 @@ --- +title: Virtual or Dedicated Servers isChild: true anchor: virtual_or_dedicated_servers --- @@ -50,4 +51,4 @@ be significantly more memory efficient and much faster but it is more work to se [apache]: http://httpd.apache.org/ [apache-MPM]: http://httpd.apache.org/docs/2.4/mod/mpm_common.html [mod_fastcgi]: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html -[mod_fcgid]: http://httpd.apache.org/mod_fcgid/ \ No newline at end of file +[mod_fcgid]: http://httpd.apache.org/mod_fcgid/ diff --git a/_posts/16-02-01-From-the-Source.md b/_posts/16-02-01-From-the-Source.md index 473798e..0a8d785 100644 --- a/_posts/16-02-01-From-the-Source.md +++ b/_posts/16-02-01-From-the-Source.md @@ -1,4 +1,5 @@ --- +title: From the Source isChild: true anchor: from_the_source --- diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index 66488cf..ab23369 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -1,4 +1,5 @@ --- +title: People to Follow isChild: true anchor: people_to_follow --- From fdcef979716b2dd546c7fa50da35a22ab984e117 Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Wed, 19 Oct 2016 09:59:09 -0500 Subject: [PATCH 055/127] Correct spelling error This is a minor spelling error change. --- _posts/14-02-01-Opcode-Cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/14-02-01-Opcode-Cache.md b/_posts/14-02-01-Opcode-Cache.md index 162cc2d..0eb1d60 100644 --- a/_posts/14-02-01-Opcode-Cache.md +++ b/_posts/14-02-01-Opcode-Cache.md @@ -13,7 +13,7 @@ It's likely an opcode cache will make a significant speed improvement to your ap Read more about opcode caches: -* [Zend OPcache][opcache-book] (bunded with PHP since 5.5) +* [Zend OPcache][opcache-book] (bundled with PHP since 5.5) * Zend OPcache (formerly known as Zend Optimizer+) is now [open source][Zend Optimizer+] * [APC] - PHP 5.4 and earlier * [XCache] From 4539ede324b4763e33ca8e3b5c4fcf0906046c5e Mon Sep 17 00:00:00 2001 From: adaroobi Date: Wed, 19 Oct 2016 21:30:35 +0300 Subject: [PATCH 056/127] Add Arabic Translation to list. --- _includes/welcome.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_includes/welcome.md b/_includes/welcome.md index 95aeb91..b074bdd 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -41,6 +41,7 @@ _PHP: The Right Way_ is translated into many different languages: * [Thai](https://apzentral.github.io/php-the-right-way/) * [Turkish](http://hkulekci.github.io/php-the-right-way/) * [Ukrainian](http://iflista.github.com/php-the-right-way/) +* [العربية](https://adaroobi.github.io/php-the-right-way/) ## How to Contribute From f5050d987b14e1ce38329854c295dc2806c71cb9 Mon Sep 17 00:00:00 2001 From: adaroobi Date: Sun, 23 Oct 2016 20:51:11 +0300 Subject: [PATCH 057/127] Updated Readme: updated Portuguese title and added Arabic link. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cae591c..33355ce 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ developers know where to find good information! * [Korean](http://modernpug.github.io/php-the-right-way) * [Persian](http://novid.github.io/php-the-right-way/) * [Polish](http://pl.phptherightway.com) -* [Portuguese](http://br.phptherightway.com) +* [Portuguese (Brazil)](http://br.phptherightway.com/) * [Romanian](https://bgui.github.io/php-the-right-way/) * [Russian](http://getjump.github.io/ru-php-the-right-way) * [Serbian](http://phpsrbija.github.io/php-the-right-way/) @@ -54,6 +54,7 @@ developers know where to find good information! * [Thai](https://apzentral.github.io/php-the-right-way/) * [Turkish](http://hkulekci.github.io/php-the-right-way/) * [Ukrainian](http://iflista.github.com/php-the-right-way) +* [العربية](https://adaroobi.github.io/php-the-right-way/) ### Translations From 580ba62b76ef06538d0a99f00b971c0bd24e2ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Borges?= Date: Mon, 24 Oct 2016 14:59:10 +0100 Subject: [PATCH 058/127] Corrected Portuguese Brazil. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cae591c..d276a7c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ developers know where to find good information! * [Korean](http://modernpug.github.io/php-the-right-way) * [Persian](http://novid.github.io/php-the-right-way/) * [Polish](http://pl.phptherightway.com) -* [Portuguese](http://br.phptherightway.com) +* [Portuguese (Brazil)](http://br.phptherightway.com) * [Romanian](https://bgui.github.io/php-the-right-way/) * [Russian](http://getjump.github.io/ru-php-the-right-way) * [Serbian](http://phpsrbija.github.io/php-the-right-way/) From d570aa0af000cd4f83f195df4614e9b96c037e33 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 25 Oct 2016 02:06:14 +0200 Subject: [PATCH 059/127] Add Arabic translation to README and sync translations --- README.md | 1 + _includes/welcome.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cae591c..b372de6 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ developers know where to find good information! * [English](http://www.phptherightway.com) +* [Arabic](https://adaroobi.github.io/php-the-right-way/) * [Bulgarian](http://bg.phptherightway.com) * [Chinese (Simplified)](http://laravel-china.github.io/php-the-right-way/) * [Chinese (Traditional)](http://laravel-taiwan.github.io/php-the-right-way) diff --git a/_includes/welcome.md b/_includes/welcome.md index b074bdd..6b9889d 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -21,6 +21,7 @@ and examples as they become available. _PHP: The Right Way_ is translated into many different languages: * [English](http://www.phptherightway.com) +* [Arabic](https://adaroobi.github.io/php-the-right-way/) * [Bulgarian](http://bg.phptherightway.com/) * [Chinese (Simplified)](http://laravel-china.github.io/php-the-right-way/) * [Chinese (Traditional)](http://laravel-taiwan.github.io/php-the-right-way) @@ -41,7 +42,6 @@ _PHP: The Right Way_ is translated into many different languages: * [Thai](https://apzentral.github.io/php-the-right-way/) * [Turkish](http://hkulekci.github.io/php-the-right-way/) * [Ukrainian](http://iflista.github.com/php-the-right-way/) -* [العربية](https://adaroobi.github.io/php-the-right-way/) ## How to Contribute From 60c2720becf3e67c6150914015bf97640ea64d4c Mon Sep 17 00:00:00 2001 From: William Turrell Date: Fri, 28 Oct 2016 11:10:36 +0100 Subject: [PATCH 060/127] Warn about composer update on production Also, greater encouragement to check composer.lock is staged in repositories. Rephrased for (imho) improved clarity. --- _posts/04-02-01-Composer-and-Packagist.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index d580acb..d396772 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -100,10 +100,11 @@ Now you can use your project dependencies, and they'll be autoloaded on demand. ### Updating your dependencies Composer creates a file called `composer.lock` which stores the exact version of each package it -downloaded when you -first ran `composer install`. If you share your project with other coders and the `composer.lock` file -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`. +downloaded when you first ran `composer install`. If you share your project with others, +ensure the `composer.lock` file is included, so that when they run `composer install` they'll +get the same versions as you. To update your dependencies, run `composer update`. Don't use +`composer update` when deploying, only `composer install`, otherwise you may end up with different +package versions on production. 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 From 247e1b69c919595f9b093da3e465784c74a72a8a Mon Sep 17 00:00:00 2001 From: Daniel Holmes Date: Wed, 9 Nov 2016 20:23:08 -0600 Subject: [PATCH 061/127] Updated information for running Apache and PHP-FPM Includes an updated link for mod_fastcgi--as it is still useful on older Apache versions--as the project host no longer hosts the documentation. However, in Apache 2.4, mod_proxy_fcgi makes this quick work, so referencing it and a clean tutorial as well. --- _posts/12-03-01-Virtual-or-Dedicated-Servers.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md index 1780ecf..73e47e2 100644 --- a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md +++ b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md @@ -35,10 +35,14 @@ Alternatively, if you want to squeeze more performance and stability out of Apac same FPM system as nginx and run the [worker MPM] or [event MPM] with mod_fastcgi or mod_fcgid. This configuration will be significantly more memory efficient and much faster but it is more work to set up. +If you are running Apache 2.4 or later, you can use [mod_proxy_fcgi] to get great performance that is easy to setup. + * [Read more on Apache][apache] * [Read more on Multi-Processing Modules][apache-MPM] * [Read more on mod_fastcgi][mod_fastcgi] * [Read more on mod_fcgid][mod_fcgid] +* [Read more on mod_proxy_fcgi][mod_proxy_fcgi] +* [Read more on setting up Apache and PHP-FPM with mod_proxy_fcgi][tutorial-mod_proxy_fcgi] [nginx]: http://nginx.org/ @@ -50,5 +54,7 @@ be significantly more memory efficient and much faster but it is more work to se [event MPM]: http://httpd.apache.org/docs/2.4/mod/event.html [apache]: http://httpd.apache.org/ [apache-MPM]: http://httpd.apache.org/docs/2.4/mod/mpm_common.html -[mod_fastcgi]: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html +[mod_fastcgi]: https://blogs.oracle.com/opal/entry/php_fpm_fastcgi_process_manager [mod_fcgid]: http://httpd.apache.org/mod_fcgid/ +[mod_proxy_fcgi]: https://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html +[tutorial-mod_proxy_fcgi]: https://serversforhackers.com/video/apache-and-php-fpm From 7ac8978a42e3d7a747cc3bdac7758465a70c3695 Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Sun, 13 Nov 2016 19:15:17 -0200 Subject: [PATCH 062/127] Suggesting the use of local gems, as they're actually cleanable --- .gitignore | 2 ++ CONTRIBUTING.md | 2 +- _config.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0b09c01..0b1620d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /_site/ *.DS_Store node_modules +vendor +.bundle diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d13345..2e3c849 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ included in the project: ```bash # Install the needed gems through Bundler - bundle install + bundle install --path vendor/bundle # Run the local server bundle exec jekyll serve ``` diff --git a/_config.yml b/_config.yml index fc11760..908205f 100644 --- a/_config.yml +++ b/_config.yml @@ -19,6 +19,6 @@ defaults: values: sitemap: false -exclude: ['CNAME', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'pages/example.md'] +exclude: ['CNAME', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'pages/example.md', 'vendor'] future: true From 12751015dfb826fd87cc1321d7e6c3157fbfd3b3 Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Sun, 13 Nov 2016 19:15:35 -0200 Subject: [PATCH 063/127] Linking to CONTRIBUTING.md from the README contribution instructions, just in case --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7cffe99..a6f47f5 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ developers know where to find good information! ## How to Contribute +You should read the `CONTRIBUTING.md` file for precise instructions and tips. But, if you prefer a TL;DR: + 1. Fork and edit 2. Optionally install [Ruby](https://rvm.io/rvm/install/) with [Jekyll](https://github.com/mojombo/jekyll/) gem to preview locally 3. Submit pull request for consideration From fc6954bc7acac256d7c9ea06a1f80cf860a1f27a Mon Sep 17 00:00:00 2001 From: Carlos Buenosvinos Date: Tue, 15 Nov 2016 09:08:46 +0100 Subject: [PATCH 064/127] Adding Domain-Driven Design in PHP --- _posts/16-10-01-Books.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index bf3e5c3..1620f2d 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -34,3 +34,4 @@ run from the command line. * [The Grumpy Programmer's Guide To Building Testable PHP Applications](https://leanpub.com/grumpy-testing) - Learning to write testable code doesn't have to suck. * [Minimum Viable Tests](https://leanpub.com/minimumviabletests) - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started. +* [Domain-Driven Design in PHP](https://leanpub.com/ddd-in-php) - See real examples written in PHP showcasing Domain-Driven Design Architectural Styles (Hexagonal Architecture, CQRS or Event Sourcing), Tactical Design Patterns, and Bounded Context Integration. From efbcbf5de21f3b3d32a19d8a0a0df4e4da6920ba Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Sat, 19 Nov 2016 17:29:12 -0500 Subject: [PATCH 065/127] Remove singleton code sample, update gemfile --- Gemfile | 1 + Gemfile.lock | 157 ++++++++++++++++++++++----------------- pages/Design-Patterns.md | 65 +--------------- 3 files changed, 91 insertions(+), 132 deletions(-) diff --git a/Gemfile b/Gemfile index 053c27d..5bf72b3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,3 @@ source 'https://rubygems.org' gem 'github-pages' +gem 'rouge' diff --git a/Gemfile.lock b/Gemfile.lock index c68e4ec..da11494 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,125 +2,146 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.2.9) - activesupport (4.2.5.1) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.3.8) + addressable (2.4.0) + blankslate (2.1.2.4) + classifier-reborn (2.0.4) + fast-stemmer (~> 1.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.10.0) colorator (0.1) - ethon (0.8.1) + concurrent-ruby (1.0.2) + ethon (0.9.1) ffi (>= 1.3.0) - execjs (2.6.0) - faraday (0.9.2) + execjs (2.7.0) + faraday (0.10.0) multipart-post (>= 1.2, < 3) - ffi (1.9.10) + fast-stemmer (1.0.2) + ffi (1.9.14) + ffi (1.9.14-x64-mingw32) gemoji (2.1.0) - github-pages (48) + github-pages (39) RedCloth (= 4.2.9) - github-pages-health-check (= 0.6.1) - jekyll (= 3.0.3) + github-pages-health-check (~> 0.2) + jekyll (= 2.4.0) jekyll-coffeescript (= 1.0.1) jekyll-feed (= 0.3.1) - jekyll-gist (= 1.4.0) - jekyll-mentions (= 1.0.0) - jekyll-paginate (= 1.1.0) - jekyll-redirect-from (= 0.9.1) + jekyll-mentions (= 0.2.1) + jekyll-redirect-from (= 0.8.0) jekyll-sass-converter (= 1.3.0) - jekyll-seo-tag (= 1.0.0) - jekyll-sitemap (= 0.10.0) - jekyll-textile-converter (= 0.1.0) - jemoji (= 0.5.1) - kramdown (= 1.9.0) - liquid (= 3.0.6) + jekyll-sitemap (= 0.8.1) + jemoji (= 0.5.0) + kramdown (= 1.5.0) + liquid (= 2.6.2) + maruku (= 0.7.0) mercenary (~> 0.3) - rdiscount (= 2.1.8) - redcarpet (= 3.3.3) - rouge (= 1.10.1) + pygments.rb (= 0.6.3) + rdiscount (= 2.1.7) + redcarpet (= 3.3.2) terminal-table (~> 1.4) - github-pages-health-check (0.6.1) - addressable (~> 2.3) - net-dns (~> 0.8) + github-pages-health-check (0.3.2) + net-dns (~> 0.6) public_suffix (~> 1.4) typhoeus (~> 0.7) - html-pipeline (2.3.0) - activesupport (>= 2, < 5) - nokogiri (>= 1.4) + html-pipeline (1.9.0) + activesupport (>= 2) + nokogiri (~> 1.4) i18n (0.7.0) - jekyll (3.0.3) + jekyll (2.4.0) + classifier-reborn (~> 2.0) colorator (~> 0.1) + jekyll-coffeescript (~> 1.0) + jekyll-gist (~> 1.0) + jekyll-paginate (~> 1.0) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 1.1) kramdown (~> 1.3) - liquid (~> 3.0) + liquid (~> 2.6.1) mercenary (~> 0.3.3) - rouge (~> 1.7) + pygments.rb (~> 0.6.0) + redcarpet (~> 3.1) safe_yaml (~> 1.0) + toml (~> 0.1.0) jekyll-coffeescript (1.0.1) coffee-script (~> 2.2) jekyll-feed (0.3.1) jekyll-gist (1.4.0) octokit (~> 4.2) - jekyll-mentions (1.0.0) - html-pipeline (~> 2.2) - jekyll (~> 3.0) + jekyll-mentions (0.2.1) + html-pipeline (~> 1.9.0) + jekyll (~> 2.0) jekyll-paginate (1.1.0) - jekyll-redirect-from (0.9.1) + jekyll-redirect-from (0.8.0) jekyll (>= 2.0) jekyll-sass-converter (1.3.0) sass (~> 3.2) - jekyll-seo-tag (1.0.0) - jekyll (>= 2.0) - jekyll-sitemap (0.10.0) - jekyll-textile-converter (0.1.0) - RedCloth (~> 4.0) - jekyll-watch (1.3.1) - listen (~> 3.0) - jemoji (0.5.1) + jekyll-sitemap (0.8.1) + jekyll-watch (1.5.0) + listen (~> 3.0, < 3.1) + jemoji (0.5.0) gemoji (~> 2.0) - html-pipeline (~> 2.2) + html-pipeline (~> 1.9) jekyll (>= 2.0) - json (1.8.3) - kramdown (1.9.0) - liquid (3.0.6) - listen (3.0.6) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9.7) - mercenary (0.3.5) - mini_portile2 (2.0.0) - minitest (5.8.4) + kramdown (1.5.0) + liquid (2.6.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + maruku (0.7.0) + mercenary (0.3.6) + mini_portile2 (2.1.0) + minitest (5.9.1) multipart-post (2.0.0) net-dns (0.8.0) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - octokit (4.2.0) - sawyer (~> 0.6.0, >= 0.5.3) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + nokogiri (1.6.8.1-x64-mingw32) + mini_portile2 (~> 2.1.0) + octokit (4.6.1) + sawyer (~> 0.8.0, >= 0.5.3) + parslet (1.5.0) + blankslate (~> 2.0) + posix-spawn (0.3.12) public_suffix (1.5.3) - rb-fsevent (0.9.7) + pygments.rb (0.6.3) + posix-spawn (~> 0.3.6) + yajl-ruby (~> 1.2.0) + rb-fsevent (0.9.8) rb-inotify (0.9.7) ffi (>= 0.5.0) - rdiscount (2.1.8) - redcarpet (3.3.3) - rouge (1.10.1) + rdiscount (2.1.7) + redcarpet (3.3.2) + rouge (2.0.7) safe_yaml (1.0.4) - sass (3.4.21) - sawyer (0.6.0) - addressable (~> 2.3.5) - faraday (~> 0.8, < 0.10) - terminal-table (1.5.2) + sass (3.4.22) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.7.3) + unicode-display_width (~> 1.1.1) thread_safe (0.3.5) + toml (0.1.2) + parslet (~> 1.5.0) typhoeus (0.8.0) ethon (>= 0.8.0) tzinfo (1.2.2) thread_safe (~> 0.1) + unicode-display_width (1.1.1) + yajl-ruby (1.2.1) PLATFORMS ruby + x64-mingw32 DEPENDENCIES github-pages + rouge + +BUNDLED WITH + 1.13.6 diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 0888d56..7bf4f5e 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -68,70 +68,7 @@ yourself a lot of trouble down the road by using factories. When designing web applications, it often makes sense conceptually and architecturally to allow access to one and only one instance of a particular class. The singleton pattern enables us to do this. -{% highlight php %} - Date: Sat, 19 Nov 2016 20:41:14 -0600 Subject: [PATCH 066/127] Update link to Tankersley's dev tools on Windows blog post Chris has provided an update to his blog post to reflect the changes brought about by Windows 10 Pro - Anniversary Edition. Bash in Windows! Docker and Hyper-V! Woo! --- _posts/01-05-01-Windows-Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/01-05-01-Windows-Setup.md b/_posts/01-05-01-Windows-Setup.md index 1435ed7..4fafe09 100644 --- a/_posts/01-05-01-Windows-Setup.md +++ b/_posts/01-05-01-Windows-Setup.md @@ -30,6 +30,6 @@ Chris Tankersley has a very helpful blog post on what tools he uses to do [PHP d [php-downloads]: http://windows.php.net/download/ [php-iis]: http://php.iis.net/ [windows-path]: http://www.windows-commandline.com/set-path-command-line/ -[windows-tools]: http://ctankersley.com/2015/07/01/developing-on-windows/ +[windows-tools]: http://ctankersley.com/2016/11/13/developing-on-windows-2016/ [wpi]: http://www.microsoft.com/web/downloads/platform.aspx [xampp]: http://www.apachefriends.org/en/xampp.html From 0dfc3bb51ca3f22af6b72cafdda0aa5616d69276 Mon Sep 17 00:00:00 2001 From: Johnny Peck Date: Tue, 22 Nov 2016 00:29:16 -0500 Subject: [PATCH 067/127] Spelling and grammar in 12-05-01 Spelling and grammar fixes for 12-05-01-Building-your-Application.md --- _posts/12-05-01-Building-your-Application.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index 0cb5106..b25e6fe 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -28,13 +28,13 @@ There are many open source tools available to help you with build automation and [Phing] can control your packaging, deployment or testing process from within a XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web application and can be extended with additional custom tasks, written in PHP. It's a solid and robust tool and has been around for a long time, however the tool could be perceived as a bit old fashioned because of the way it deals with configuration (XML files). -[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however you can successfully deploying PHP systems with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. Dave Gardner's blog post [PHP Deployment with Capistrano][phpdeploy_capistrano] is a good starting point for PHP developers interested in Capistrano. +[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however you can successfully deploy PHP systems with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. Dave Gardner's blog post [PHP Deployment with Capistrano][phpdeploy_capistrano] is a good starting point for PHP developers interested in Capistrano. -[Rocketeer] gets its inspiration and philosophy from the Laravel framework. Its goal is to be fast, elegant and ease to use with smart defaults. It features multiple servers, multiple stages, atomic deploys and deployment can be performed in parallel. Everything in the tool can be hot swapped or extended, and everything is written in PHP. +[Rocketeer] gets its inspiration and philosophy from the Laravel framework. Its goal is to be fast, elegant and easy to use with smart defaults. It features multiple servers, multiple stages, atomic deploys and deployment can be performed in parallel. Everything in the tool can be hot swapped or extended, and everything is written in PHP. -[Deployer] is a deployment tool written in PHP, it's simple and functional. Runs tasks in parallel, atomic deployment, keeps consistency between servers. Recipes of common tasks for Symfony, Laravel, Zend Framework and Yii. Younes Rafie's article [Easy Deployment of PHP Applications with Deployer][phpdeploy_deployer] is a great tutorial for deploying your application with the tool. +[Deployer] is a deployment tool written in PHP. It's simple and functional. Features include running tasks in parallel, atomic deployment and keeping consistency between servers. Recipes of common tasks for Symfony, Laravel, Zend Framework and Yii are available. Younes Rafie's article [Easy Deployment of PHP Applications with Deployer][phpdeploy_deployer] is a great tutorial for deploying your application with the tool. -[Magallanes] another tool written in PHP with simple configuration done in YAML files. It has support for multiple servers and environments, atomic deployment, and have some built in tasks that you can leverage for common tools and frameworks. +[Magallanes] is another tool written in PHP with simple configuration done in YAML files. It has support for multiple servers and environments, atomic deployment, and has some built in tasks that you can leverage for common tools and frameworks. #### Further reading: @@ -106,4 +106,4 @@ PHP. [Puppet]: https://puppet.com/ [ansible_for_devops]: https://leanpub.com/ansible-for-devops [ansible_for_aws]: https://leanpub.com/ansible-for-aws -[an_ansible_tutorial]: https://serversforhackers.com/an-ansible-tutorial \ No newline at end of file +[an_ansible_tutorial]: https://serversforhackers.com/an-ansible-tutorial From feb05f2e0cdbdbe17a3528971054c7e66a9b5699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Wed, 30 Nov 2016 00:23:58 +0000 Subject: [PATCH 068/127] Add php-mock and humbug --- _posts/11-04-01-Complementary-Testing-Tools.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_posts/11-04-01-Complementary-Testing-Tools.md b/_posts/11-04-01-Complementary-Testing-Tools.md index e0af3a4..b7ed173 100644 --- a/_posts/11-04-01-Complementary-Testing-Tools.md +++ b/_posts/11-04-01-Complementary-Testing-Tools.md @@ -14,6 +14,8 @@ libraries useful for any preferred approach taken. * [Mockery] is a Mock Object Framework which can be integrated with [PHPUnit] or [PHPSpec] * [Prophecy] is a highly opinionated yet very powerful and flexible PHP object mocking framework. It's integrated with [PHPSpec] and can be used with [PHPUnit]. +* [php-mock] is a library to help to mock PHP native functions. +* [Humbug] is a PHP implementation of [Mutation Testing] to help to measure the effectiveness of your tests. [Selenium]: http://seleniumhq.org/ @@ -22,3 +24,6 @@ libraries useful for any preferred approach taken. [PHPUnit]: http://phpunit.de/ [PHPSpec]: http://www.phpspec.net/ [Prophecy]: https://github.com/phpspec/prophecy +[php-mock]: https://github.com/php-mock/php-mock +[Humbug]: https://github.com/padraic/humbug +[Mutation Testing]: https://en.wikipedia.org/wiki/Mutation_testing From 67b9a9a7e5673dabddeaf39f429104bc275d93d9 Mon Sep 17 00:00:00 2001 From: reksc Date: Thu, 1 Dec 2016 12:49:00 +0100 Subject: [PATCH 069/127] Link to the book --- _includes/welcome.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index b074bdd..2c02bbf 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -43,16 +43,21 @@ _PHP: The Right Way_ is translated into many different languages: * [Ukrainian](http://iflista.github.com/php-the-right-way/) * [العربية](https://adaroobi.github.io/php-the-right-way/) +## Book + +The most recent version of _PHP: The Right Way_ is also available in PDF, EPUB and MOBI formats. [Go to Leanpub][1] + ## How to Contribute -Help make this website the best resource for new PHP programmers! [Contribute on GitHub][1] +Help make this website the best resource for new PHP programmers! [Contribute on GitHub][2] ## Spread the Word! _PHP: The Right Way_ has web banner images you can use on your website. Show your support, and let new PHP developers know where to find good information! -[See Banner Images][2] +[See Banner Images][3] -[1]: https://github.com/codeguy/php-the-right-way/tree/gh-pages -[2]: /banners.html +[1]: https://leanpub.com/phptherightway +[2]: https://github.com/codeguy/php-the-right-way/tree/gh-pages +[3]: /banners.html From 0819da2f2f9cf47fefc3b5d5beedc4a9e5c37c21 Mon Sep 17 00:00:00 2001 From: Szymon Krajewski Date: Fri, 2 Dec 2016 22:08:06 +0100 Subject: [PATCH 070/127] Remove info about Whoops in Laravel --- _posts/09-02-01-Errors.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/_posts/09-02-01-Errors.md b/_posts/09-02-01-Errors.md index fd2bf64..a99a9bb 100644 --- a/_posts/09-02-01-Errors.md +++ b/_posts/09-02-01-Errors.md @@ -131,9 +131,8 @@ PHP is perfectly capable of being an "exception-heavy" programming language, and make the switch. Basically you can throw your "errors" as "exceptions" using the `ErrorException` class, which extends the `Exception` class. -This is a common practice implemented by a large number of modern frameworks such as Symfony and Laravel. By default -Laravel will display all errors as exceptions using the [Whoops!] package if the `app.debug` switch is turned on, then -hide them if the switch is turned off. +This is a common practice implemented by a large number of modern frameworks such as Symfony and Laravel. In debug +mode *(or dev mode)* both of these frameworks will display a nice and clean *stack trace*. By throwing errors as exceptions in development you can handle them better than the usual result, and if you see an exception during development you can wrap it in a catch statement with specific instructions on how to handle the From 920d2164f37fca03a89b60c21d9c48a1240357ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emir=20Kars=CC=A7=C4=B1yakal=C4=B1?= Date: Fri, 23 Dec 2016 23:58:28 +0300 Subject: [PATCH 071/127] updated current stable version section to 7.1 and added php71 option to brewing --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 10 +++++----- _posts/01-04-01-Mac-Setup.md | 2 +- 2 files changed, 6 insertions(+), 6 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 d2994c0..caed092 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -1,16 +1,16 @@ --- -title: Use the Current Stable Version (7.0) +title: Use the Current Stable Version (7.1) isChild: true anchor: use_the_current_stable_version --- -## Use the Current Stable Version (7.0) {#use_the_current_stable_version_title} +## Use the Current Stable Version (7.1) {#use_the_current_stable_version_title} -If you are getting started with PHP, start with the current stable release of [PHP 7.0][php-release]. PHP 7.0 is very +If you are getting started with PHP, start with the current stable release of [PHP 7.1][php-release]. PHP 7.1 is very new, and adds many amazing [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. -Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php70-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. +Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php71-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. [php-release]: http://php.net/downloads.php [php-docs]: http://php.net/manual/ -[php70-bc]: http://php.net/manual/migration70.incompatible.php +[php71-bc]: http://php.net/manual/migration71.incompatible.php diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index 74abe62..b9b706e 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -15,7 +15,7 @@ There are multiple ways to install PHP on OS X. [Homebrew] is a powerful package manager for OS X, which can help you install PHP and various extensions easily. [Homebrew PHP] is a repository that contains PHP-related "formulae" for Homebrew, and will let you install PHP. -At this point, you can install `php53`, `php54`, `php55`, `php56` or `php70` using the `brew install` command, and switch +At this point, you can install `php53`, `php54`, `php55`, `php56`, `php70` or `php71` using the `brew install` command, and switch between them by modifying your `PATH` variable. Alternatively you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you. ### Install PHP via Macports From 6e5fdee5884ae8f3d2345144f78f8d5b823b4970 Mon Sep 17 00:00:00 2001 From: Daniel Saavedra Date: Thu, 19 Jan 2017 17:55:15 -0400 Subject: [PATCH 072/127] Fixed Broken links --- _posts/01-05-01-Windows-Setup.md | 34 +++++++++---------- ...1-Internationalization-and-Localization.md | 10 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/_posts/01-05-01-Windows-Setup.md b/_posts/01-05-01-Windows-Setup.md index 4fafe09..438fe52 100644 --- a/_posts/01-05-01-Windows-Setup.md +++ b/_posts/01-05-01-Windows-Setup.md @@ -1,22 +1,22 @@ ---- -isChild: true -anchor: windows_setup ---- - -## Windows Setup {#windows_setup_title} - -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. - +--- +isChild: true +anchor: windows_setup +--- + +## Windows Setup {#windows_setup_title} + +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 -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. +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 -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. +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. Generally running your application on different environment in development and production can lead to strange bugs popping up when you go live. If you are developing on Windows and deploying to Linux (or anything non-Windows) then you should consider using a [Virtual Machine](/#virtualization_title). @@ -31,5 +31,5 @@ Chris Tankersley has a very helpful blog post on what tools he uses to do [PHP d [php-iis]: http://php.iis.net/ [windows-path]: http://www.windows-commandline.com/set-path-command-line/ [windows-tools]: http://ctankersley.com/2016/11/13/developing-on-windows-2016/ -[wpi]: http://www.microsoft.com/web/downloads/platform.aspx +[wpi]: https://www.microsoft.com/web/downloads/platform.aspx [xampp]: http://www.apachefriends.org/en/xampp.html diff --git a/_posts/05-06-01-Internationalization-and-Localization.md b/_posts/05-06-01-Internationalization-and-Localization.md index c52b3a9..7b38284 100644 --- a/_posts/05-06-01-Internationalization-and-Localization.md +++ b/_posts/05-06-01-Internationalization-and-Localization.md @@ -141,7 +141,7 @@ given number falls (starting the count with 0). For example: - Brazilian Portuguese: `nplurals=2; plural=(n > 1);` - two rules, second if N is bigger than one, first otherwise Now that you understood the basis of how plural rules works - and if you didn't, please look at a deeper explanation -on the [LingoHub tutorial](lingohub_plurals) -, you might want to copy the ones you need from a [list][plural] instead +on the [LingoHub tutorial][lingohub_plurals] -, you might want to copy the ones you need from a [list][plural] instead of writing them by hand. When calling out Gettext to do localization on sentences with counters, you'll have to give him the @@ -174,7 +174,7 @@ msgstr[1] "%d mensagens não lidas" The first section works like a header, having the `msgid` and `msgstr` especially empty. It describes the file encoding, plural forms and other things that are less relevant. The second section translates a simple string from English to -Brazilian Portuguese, and the third does the same, but leveraging string replacement from [`sprintf`](sprintf) so the +Brazilian Portuguese, and the third does the same, but leveraging string replacement from [`sprintf`][sprintf] so the translation may contain the user name and visit date. The last section is a sample of pluralization forms, displaying the singular and plural version as `msgid` in English and their corresponding translations as `msgstr` 0 and 1 @@ -310,7 +310,7 @@ textdomain('main'); To make matters easier - and one of the powerful advantages Gettext has over custom framework i18n packages - is its custom file type. "Oh man, that's quite hard to understand and edit by hand, a simple array would be easier!" Make no mistake, applications like [Poedit] are here to help - _a lot_. You can get the program from -[their website](poedit_download), it's free and available for all platforms. It's a pretty easy tool to get used to, +[their website][poedit_download], it's free and available for all platforms. It's a pretty easy tool to get used to, and a very powerful one at the same time - using all powerful features Gettext has available. In the first run, you should select "File > New Catalog" from the menu. There you'll have a small screen where we will @@ -369,7 +369,7 @@ or maybe a fancy `_r()` that would join `gettext()` and `sprintf()` calls. Other In those cases, you'll need to instruct the Gettext utility on how to extract the strings from those new functions. Don't be afraid, it's very easy. It's just a field in the `.po` file, or a Settings screen on Poedit. In the editor, that option is inside "Catalog > Properties > Source keywords". You need to include there the specifications of those -new functions, following [a specific format](func_format): +new functions, following [a specific format][func_format]: - if you create something like `t()` that simply returns the translation for a string, you can specify it as `t`. Gettext will know the only function argument is the string to be translated; @@ -385,7 +385,7 @@ After including those new rules in the `.po` file, a new scan will bring in your * [Wikipedia: i18n and l10n](https://en.wikipedia.org/wiki/Internationalization_and_localization) * [Wikipedia: Gettext](https://en.wikipedia.org/wiki/Gettext) -* [LingoHub: PHP internationalization with gettext tutorial](lingohub) +* [LingoHub: PHP internationalization with gettext tutorial][lingohub] * [PHP Manual: Gettext](http://php.net/manual/en/book.gettext.php) * [Gettext Manual][manual] From d628ff4fb9a95834e07458fb0361b4ded938c47b Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 23 Jan 2017 06:06:25 +0100 Subject: [PATCH 073/127] Add native languages for translations --- README.md | 42 +++++++++++++++++++++--------------------- _includes/welcome.md | 42 +++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b372de6..af713c4 100644 --- a/README.md +++ b/README.md @@ -34,27 +34,27 @@ developers know where to find good information! * [English](http://www.phptherightway.com) -* [Arabic](https://adaroobi.github.io/php-the-right-way/) -* [Bulgarian](http://bg.phptherightway.com) -* [Chinese (Simplified)](http://laravel-china.github.io/php-the-right-way/) -* [Chinese (Traditional)](http://laravel-taiwan.github.io/php-the-right-way) -* [French](http://eilgin.github.io/php-the-right-way/) -* [German](http://rwetzlmayr.github.io/php-the-right-way) -* [Indonesian](http://id.phptherightway.com) -* [Italian](http://it.phptherightway.com) -* [Japanese](http://ja.phptherightway.com) -* [Korean](http://modernpug.github.io/php-the-right-way) -* [Persian](http://novid.github.io/php-the-right-way/) -* [Polish](http://pl.phptherightway.com) -* [Portuguese](http://br.phptherightway.com) -* [Romanian](https://bgui.github.io/php-the-right-way/) -* [Russian](http://getjump.github.io/ru-php-the-right-way) -* [Serbian](http://phpsrbija.github.io/php-the-right-way/) -* [Slovenian](http://sl.phptherightway.com) -* [Spanish](http://phpdevenezuela.github.io/php-the-right-way) -* [Thai](https://apzentral.github.io/php-the-right-way/) -* [Turkish](http://hkulekci.github.io/php-the-right-way/) -* [Ukrainian](http://iflista.github.com/php-the-right-way) +* [Deutsch](http://rwetzlmayr.github.io/php-the-right-way) +* [Español](http://phpdevenezuela.github.io/php-the-right-way) +* [Français](http://eilgin.github.io/php-the-right-way/) +* [Indonesia](http://id.phptherightway.com) +* [Italiano](http://it.phptherightway.com) +* [Polski](http://pl.phptherightway.com) +* [Português do Brasil](http://br.phptherightway.com) +* [Română](https://bgui.github.io/php-the-right-way/) +* [Slovenščina](http://sl.phptherightway.com) +* [Srpski](http://phpsrbija.github.io/php-the-right-way/) +* [Türkçe](http://hkulekci.github.io/php-the-right-way/) +* [български](http://bg.phptherightway.com) +* [Русский язык](http://getjump.github.io/ru-php-the-right-way) +* [Українська](http://iflista.github.com/php-the-right-way) +* [العربية](https://adaroobi.github.io/php-the-right-way/) +* [فارسى](http://novid.github.io/php-the-right-way/) +* [ภาษาไทย](https://apzentral.github.io/php-the-right-way/) +* [한국어판](http://modernpug.github.io/php-the-right-way) +* [日本語](http://ja.phptherightway.com) +* [简体中文](http://laravel-china.github.io/php-the-right-way/) +* [繁體中文](http://laravel-taiwan.github.io/php-the-right-way) ### Translations diff --git a/_includes/welcome.md b/_includes/welcome.md index 6b9889d..9ab0407 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -21,27 +21,27 @@ and examples as they become available. _PHP: The Right Way_ is translated into many different languages: * [English](http://www.phptherightway.com) -* [Arabic](https://adaroobi.github.io/php-the-right-way/) -* [Bulgarian](http://bg.phptherightway.com/) -* [Chinese (Simplified)](http://laravel-china.github.io/php-the-right-way/) -* [Chinese (Traditional)](http://laravel-taiwan.github.io/php-the-right-way) -* [French](http://eilgin.github.io/php-the-right-way/) -* [German](http://rwetzlmayr.github.io/php-the-right-way/) -* [Indonesian](http://id.phptherightway.com/) -* [Italian](http://it.phptherightway.com/) -* [Japanese](http://ja.phptherightway.com) -* [Korean](http://modernpug.github.io/php-the-right-way/) -* [Persian](http://novid.github.io/php-the-right-way/) -* [Polish](http://pl.phptherightway.com/) -* [Portuguese (Brazil)](http://br.phptherightway.com/) -* [Romanian](https://bgui.github.io/php-the-right-way/) -* [Russian](http://getjump.github.io/ru-php-the-right-way) -* [Serbian](http://phpsrbija.github.io/php-the-right-way/) -* [Slovenian](http://sl.phptherightway.com) -* [Spanish](http://phpdevenezuela.github.io/php-the-right-way/) -* [Thai](https://apzentral.github.io/php-the-right-way/) -* [Turkish](http://hkulekci.github.io/php-the-right-way/) -* [Ukrainian](http://iflista.github.com/php-the-right-way/) +* [Deutsch](http://rwetzlmayr.github.io/php-the-right-way) +* [Español](http://phpdevenezuela.github.io/php-the-right-way) +* [Français](http://eilgin.github.io/php-the-right-way/) +* [Indonesia](http://id.phptherightway.com) +* [Italiano](http://it.phptherightway.com) +* [Polski](http://pl.phptherightway.com) +* [Português do Brasil](http://br.phptherightway.com) +* [Română](https://bgui.github.io/php-the-right-way/) +* [Slovenščina](http://sl.phptherightway.com) +* [Srpski](http://phpsrbija.github.io/php-the-right-way/) +* [Türkçe](http://hkulekci.github.io/php-the-right-way/) +* [български](http://bg.phptherightway.com) +* [Русский язык](http://getjump.github.io/ru-php-the-right-way) +* [Українська](http://iflista.github.com/php-the-right-way) +* [العربية](https://adaroobi.github.io/php-the-right-way/) +* [فارسى](http://novid.github.io/php-the-right-way/) +* [ภาษาไทย](https://apzentral.github.io/php-the-right-way/) +* [한국어판](http://modernpug.github.io/php-the-right-way) +* [日本語](http://ja.phptherightway.com) +* [简体中文](http://laravel-china.github.io/php-the-right-way/) +* [繁體中文](http://laravel-taiwan.github.io/php-the-right-way) ## How to Contribute From 05c3400ef6b175f03450b1fa56af23d3b6504cce Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 23 Jan 2017 20:56:55 +0100 Subject: [PATCH 074/127] Update information about PHP 7 --- _posts/01-04-01-Mac-Setup.md | 10 +++++----- _posts/07-02-01-Databases_MySQL.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index b9b706e..0e88359 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -6,7 +6,7 @@ anchor: mac_setup ## Mac Setup {#mac_setup_title} OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mavericks has 5.4.17, -Yosemite 5.5.9, El Capitan 5.5.29 and Sierra 5.6.24, but with PHP 7.0 out that is often not good enough. +Yosemite 5.5.9, El Capitan 5.5.29 and Sierra 5.6.24, but with PHP 7.1 out that is often not good enough. There are multiple ways to install PHP on OS X. @@ -29,14 +29,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` or `php70` using the `port install` command, for example: +At this point, you can install `php54`, `php55`, `php56`, `php70` or `php71` using the `port install` command, for example: sudo port install php56 - sudo port install php70 + sudo port install php71 And you can run `select` command to switch your active PHP: - sudo port select --set php php70 + sudo port select --set php php71 ### Install PHP via phpbrew @@ -45,7 +45,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. +Another popular option is [php-osx.liip.ch] which provides one liner installation methods for versions 5.3 through 7.1. It doesn't overwrite the PHP binaries installed by Apple, but installs everything in a separate location (/usr/local/php5). ### Compile from Source diff --git a/_posts/07-02-01-Databases_MySQL.md b/_posts/07-02-01-Databases_MySQL.md index c1d5e55..476ffc9 100644 --- a/_posts/07-02-01-Databases_MySQL.md +++ b/_posts/07-02-01-Databases_MySQL.md @@ -6,7 +6,7 @@ anchor: mysql_extension ## MySQL Extension {#mysql_extension_title} -The [mysql] extension for PHP is incredibly old and has superseded by two other extensions: +The [mysql] extension for PHP is incredibly old and has superseded by two other extensions: - [mysqli] - [pdo] @@ -14,12 +14,12 @@ The [mysql] extension for PHP is incredibly old and has superseded by two other Not only did development stop long ago on [mysql], but it was [deprecated as of PHP 5.5.0] [mysql_deprecated], and **has been [officially removed in PHP 7.0][mysql_removed]**. -To save digging into your `php.ini` settings to see which module you are using, one option is to search for `mysql_*` -in your editor of choice. If any functions such as `mysql_connect()` and `mysql_query()` show up, then `mysql` is +To save digging into your `php.ini` settings to see which module you are using, one option is to search for `mysql_*` +in your editor of choice. If any functions such as `mysql_connect()` and `mysql_query()` show up, then `mysql` is in use. -Even if you are not using PHP 7.0 yet, failing to consider this upgrade as soon as possible will lead to greater -hardship when the PHP 7.0 upgrade does come about. The best option is to replace mysql usage with [mysqli] or [PDO] in +Even if you are not using PHP 7.x yet, failing to consider this upgrade as soon as possible will lead to greater +hardship when the PHP 7.x upgrade does come about. The best option is to replace mysql usage with [mysqli] or [PDO] in your applications within your own development schedules so you won't be rushed later on. **If you are upgrading from [mysql] to [mysqli], beware lazy upgrade guides that suggest you can simply find and replace `mysql_*` with `mysqli_*`. Not only is that a gross oversimplification, it misses out on the advantages that mysqli provides, such as parameter binding, which is also offered in [PDO][pdo].** From 5cad0d04c671edf41d3a3a2c74f871b066a012d1 Mon Sep 17 00:00:00 2001 From: "Paul M. Jones" Date: Tue, 31 Jan 2017 10:52:47 -0600 Subject: [PATCH 075/127] add aura/intl --- _posts/05-06-01-Internationalization-and-Localization.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_posts/05-06-01-Internationalization-and-Localization.md b/_posts/05-06-01-Internationalization-and-Localization.md index 7b38284..5bec5d9 100644 --- a/_posts/05-06-01-Internationalization-and-Localization.md +++ b/_posts/05-06-01-Internationalization-and-Localization.md @@ -41,6 +41,9 @@ There are common libraries used that support Gettext and other implementations o install or sport additional features or i18n file formats. In this document, we focus on the tools provided with the PHP core, but here we list others for completion: +- [aura/intl][aura-intl]: Provides internationalization (I18N) tools, specifically package-oriented per-locale message +translation. It uses array formats for message. Does not provide a message extractor, but does provide advanced +message formatting via the `intl` extension (including pluralized messages). - [oscarotero/Gettext][oscarotero]: Gettext support with an OO interface; includes improved helper functions, powerful extractors for several file formats (some of them not supported natively by the `gettext` command), and can also export to other formats besides `.mo/.po` files. Can be useful if you need to integrate your translation files into other parts @@ -400,6 +403,7 @@ After including those new rules in the `.po` file, a new scan will bring in your [3166-1]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 [rare]: http://www.gnu.org/software/gettext/manual/gettext.html#Rare-Language-Codes [func_format]: https://www.gnu.org/software/gettext/manual/gettext.html#Language-specific-options +[aura-intl]: https://github.com/auraphp/Aura.Intl [oscarotero]: https://github.com/oscarotero/Gettext [symfony]: https://symfony.com/doc/current/components/translation.html [zend]: https://docs.zendframework.com/zend-i18n/translation From 3b848d855f9438d2d382f26d96a3f8445f09478f Mon Sep 17 00:00:00 2001 From: Jagroop Singh Date: Fri, 10 Mar 2017 13:10:56 +0530 Subject: [PATCH 076/127] fixed missing square bracket in array --- _posts/05-06-01-Internationalization-and-Localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/05-06-01-Internationalization-and-Localization.md b/_posts/05-06-01-Internationalization-and-Localization.md index 7b38284..7e53a5d 100644 --- a/_posts/05-06-01-Internationalization-and-Localization.md +++ b/_posts/05-06-01-Internationalization-and-Localization.md @@ -257,7 +257,7 @@ call. More on domain configuration in the next example. * @return bool */ function valid($locale) { - return in_array($locale, ['en_US', 'en', 'pt_BR', 'pt', 'es_ES', 'es'); + return in_array($locale, ['en_US', 'en', 'pt_BR', 'pt', 'es_ES', 'es']); } //setting the source/default locale, for informational purposes From 0d9637ccf7b6665a6d62ef8f03104034ef61c823 Mon Sep 17 00:00:00 2001 From: Euge Starr Date: Wed, 3 May 2017 20:32:29 +1200 Subject: [PATCH 077/127] grammar fixes --- _posts/01-04-01-Mac-Setup.md | 2 +- _posts/02-01-01-Code-Style-Guide.md | 2 +- _posts/05-03-01-Date-and-Time.md | 2 +- _posts/06-02-01-Basic-Concept.md | 2 +- _posts/06-03-01-Complex-Problem.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index 0e88359..dc06ddf 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -16,7 +16,7 @@ There are multiple ways to install PHP on OS X. [Homebrew PHP] is a repository that contains PHP-related "formulae" for Homebrew, and will let you install PHP. At this point, you can install `php53`, `php54`, `php55`, `php56`, `php70` or `php71` using the `brew install` command, and switch -between them by modifying your `PATH` variable. Alternatively you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you. +between them by modifying your `PATH` variable. Alternatively, you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you. ### Install PHP via Macports diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 3365509..65e7bb5 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -15,7 +15,7 @@ recommendations are merely a set of rules that many projects like Drupal, Zend, FuelPHP, Lithium, etc are adopting. You can use them for your own projects, or continue to use your own personal style. -Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one +Ideally, you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, and applications that implement the components can have consistency even when working with lots of third-party code. diff --git a/_posts/05-03-01-Date-and-Time.md b/_posts/05-03-01-Date-and-Time.md index c56781a..499d074 100644 --- a/_posts/05-03-01-Date-and-Time.md +++ b/_posts/05-03-01-Date-and-Time.md @@ -43,7 +43,7 @@ On DateTime objects you can use standard comparison: {% highlight php %} Date: Mon, 15 May 2017 01:05:29 +0200 Subject: [PATCH 078/127] Example code consistency Added surrounding
  • tags just to be consistent with code examples at line 16 and 37 --- _posts/07-04-01-Interacting-via-Code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index 5cae4f0..3004664 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -86,7 +86,7 @@ class FooModel {% highlight php %} - - +
  • -
  • {% endhighlight %} From 165f7f9bc894d7e77cd6626e555d44b3060c6698 Mon Sep 17 00:00:00 2001 From: Kushal Date: Wed, 14 Jun 2017 13:50:10 +0530 Subject: [PATCH 079/127] Create 09-02-01-Errors.md --- _posts/09-02-01-Errors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_posts/09-02-01-Errors.md b/_posts/09-02-01-Errors.md index a99a9bb..c510a70 100644 --- a/_posts/09-02-01-Errors.md +++ b/_posts/09-02-01-Errors.md @@ -132,7 +132,9 @@ make the switch. Basically you can throw your "errors" as "exceptions" using the the `Exception` class. This is a common practice implemented by a large number of modern frameworks such as Symfony and Laravel. In debug -mode *(or dev mode)* both of these frameworks will display a nice and clean *stack trace*. +mode *(or dev mode)* both of these frameworks will display a nice and clean *stack trace*. + +There are also some packages available for better error and exception handling and reporting. Like [Whoops!], which comes with the default installation of Laravel and can be used in any framework as well. By throwing errors as exceptions in development you can handle them better than the usual result, and if you see an exception during development you can wrap it in a catch statement with specific instructions on how to handle the From 1dbbd39d62762f5d806ebb6dcd3b9cbdb7de22de Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Thu, 29 Jun 2017 13:12:05 -0500 Subject: [PATCH 080/127] Add new list of PHP leaders compiled by OGProgrammer --- _posts/16-03-01-People-to-Follow.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index ab23369..2ddf768 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -11,7 +11,9 @@ community members when you are first starting out. You can find a comprehensive list of PHP community members and their Twitter handles at: -* [25 PHP Developers to Follow Online][php-developers-to-follow] +* [New Relic: 25 PHP Developers to Follow Online][php-developers-to-follow] +* [OGProgrammer: How to get connected with the PHP community][og-twitter-list] [php-developers-to-follow]: https://blog.newrelic.com/2014/05/02/25-php-developers-follow-online/ +[og-twitter-list]: https://www.ogprogrammer.com/2017/06/28/how-to-get-connected-with-the-php-community/ From 88329152a7ab7b2f19546fb4b9bdba2e7869849f Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Fri, 7 Jul 2017 01:49:22 -0500 Subject: [PATCH 081/127] Add information about the common directory structure used for php dev work This information is based on the great analysis done by Paul M. Jones. --- _posts/01-06-01-Common-Directory-Structure.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 _posts/01-06-01-Common-Directory-Structure.md diff --git a/_posts/01-06-01-Common-Directory-Structure.md b/_posts/01-06-01-Common-Directory-Structure.md new file mode 100644 index 0000000..69a16f9 --- /dev/null +++ b/_posts/01-06-01-Common-Directory-Structure.md @@ -0,0 +1,19 @@ +--- +title: Common Directory Structure +isChild: true +anchor: common_directory_structure +--- + +## Common Directory structure {#common_directory_structure_title} + +A common question among those starting out with writing programs for the web is, "where do I put my stuff?" Over the years, this answer has consistently been "where the `DocumentRoot` is." Although this answer is not complete, it's a great place to start. + +For security reasons, configuration files should not be accessible by a site's visitors; therefore, public scripts are kept in a public directory and private configurations and data are kept outside of that directory. + +For each team, CMS, or framework one works in, a standard directory structure is used by each of those entities. However, if one is starting a project alone, knowing which filesystem structure to use can be daunting. + +[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. + +[Paul M. Jones]: https://twitter.com/pmjones +[Standard PHP Package Skeleton]: https://github.com/php-pds/skeleton +[Composer]: /#composer_and_packagist From cc6557ed4ebf950fa456b421944ac73210c44575 Mon Sep 17 00:00:00 2001 From: Brian Jackson Date: Wed, 4 Oct 2017 10:21:35 -0700 Subject: [PATCH 082/127] Update best practices Add article discussing the importance of using the latest support PHP versions. --- _posts/16-08-01-Sites.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/16-08-01-Sites.md b/_posts/16-08-01-Sites.md index 7eaedca..b6e8403 100644 --- a/_posts/16-08-01-Sites.md +++ b/_posts/16-08-01-Sites.md @@ -16,6 +16,7 @@ PHP versions * [PHP Best Practices](https://phpbestpractices.org/) * [Best practices for Modern PHP Development](https://www.airpair.com/php/posts/best-practices-for-modern-php-development) +* [Why You Should Be Using Supported PHP Versions](https://kinsta.com/blog/php-versions/) ### News around the PHP and web development communities You can subscribe to weekly newsletters to keep yourself informed on new libraries, latest news, events and general From fc6acc0daad23218e9b8e3161a75705832c3f7c8 Mon Sep 17 00:00:00 2001 From: Mamat Rahmat Date: Tue, 21 Nov 2017 01:05:48 +0700 Subject: [PATCH 083/127] Fix broken link --- _posts/06-05-01-Further-Reading.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/06-05-01-Further-Reading.md b/_posts/06-05-01-Further-Reading.md index dd18d1c..f9553b4 100644 --- a/_posts/06-05-01-Further-Reading.md +++ b/_posts/06-05-01-Further-Reading.md @@ -9,4 +9,4 @@ anchor: further_reading * [What is Dependency Injection?](http://fabien.potencier.org/article/11/what-is-dependency-injection) * [Dependency Injection: An analogy](https://mwop.net/blog/260-Dependency-Injection-An-analogy.html) * [Dependency Injection: Huh?](http://net.tutsplus.com/tutorials/php/dependency-injection-huh/) -* [Dependency Injection as a tool for testing](http://philipobenito.github.io/dependency-injection-as-a-tool-for-testing/) +* [Dependency Injection as a tool for testing](https://medium.com/philipobenito/dependency-injection-as-a-tool-for-testing-902c21c147f1) From 1a62ece55b19d2bf70beb5e4c1424c2feb3c6706 Mon Sep 17 00:00:00 2001 From: NJ Date: Wed, 7 Feb 2018 15:17:50 -0800 Subject: [PATCH 084/127] Use utf8mb4 instead of utf8 in MySQL database connection string --- _posts/07-04-01-Interacting-via-Code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index 5cae4f0..8f7d2b3 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -48,7 +48,7 @@ logic in and you have a "View", which is very nearly [MVC] - a common OOP archit {% highlight php %} Date: Mon, 26 Feb 2018 11:19:29 +0100 Subject: [PATCH 085/127] Update Functional-Programming.md --- pages/Functional-Programming.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/Functional-Programming.md b/pages/Functional-Programming.md index 85bb97f..2ad68dd 100644 --- a/pages/Functional-Programming.md +++ b/pages/Functional-Programming.md @@ -8,7 +8,7 @@ sitemap: true PHP supports first-class functions, meaning that a function can be assigned to a variable. Both user-defined and built-in functions can be referenced by a variable and invoked dynamically. Functions can be passed as arguments to -other functions and a function can return other functions (a feature called higher-order functions). +other functions and a function can return other functions (a feature called higher-order functions). Recursion, a feature that allows a function to call itself, is supported by the language, but most of the PHP code focus is on iteration. @@ -71,12 +71,12 @@ $output = array_filter($input, criteria_greater_than(3)); print_r($output); // items > 3 {% endhighlight %} -Each filter function in the family accepts only elements greater than some minimum value. Single filter returned by +Each filter function in the family accepts only elements greater than some minimum value. The single filter returned by `criteria_greater_than` is a closure with `$min` argument closed by the value in the scope (given as an argument when `criteria_greater_than` is called). Early binding is used by default for importing `$min` variable into the created function. For true closures with late -binding one should use a reference when importing. Imagine a templating or input validation library, where closure is +binding one should use a reference when importing. Imagine a templating or input validation library, where a closure is defined to capture variables in scope and access them later when the anonymous function is evaluated. * [Read about Anonymous functions][anonymous-functions] From 8fbfb9f8c59bc1429ebb5e5041417066045838e9 Mon Sep 17 00:00:00 2001 From: Oluwafemi Sule Date: Fri, 23 Mar 2018 14:34:44 +0100 Subject: [PATCH 086/127] highlight statement syntax for multiline strings --- pages/The-Basics.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pages/The-Basics.md b/pages/The-Basics.md index b13ceb2..bfb3a9f 100644 --- a/pages/The-Basics.md +++ b/pages/The-Basics.md @@ -290,6 +290,26 @@ EOD; // closing 'EOD' must be on it's own line, and to th * [Heredoc syntax](http://php.net/language.types.string#language.types.string.syntax.heredoc) +> It should be noted that multiline strings can also be formed by continuing them across multilines in a statement. _e.g._ + +{% highlight php %} +$str = " +Example of string +spanning multiple lines +using statement syntax. +$a are parsed. +"; + +/** + * Output: + * + * Example of string + * spanning multiple lines + * using statement syntax. + * Variables are parsed. + */ +{% endhighlight %} + ### Which is quicker? There is a myth floating around that single quote strings are fractionally quicker than double quote strings. This is From 0166b9e232bbd3fd77cb520325ac5151efbb087b Mon Sep 17 00:00:00 2001 From: ADmad Date: Thu, 5 Apr 2018 01:51:16 +0530 Subject: [PATCH 087/127] Add CakePHP's standalone packages/components --- _posts/16-07-01-Components.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/_posts/16-07-01-Components.md b/_posts/16-07-01-Components.md index c614d9b..616ea7d 100644 --- a/_posts/16-07-01-Components.md +++ b/_posts/16-07-01-Components.md @@ -20,6 +20,13 @@ another source of packages which ideally have little to no dependencies on other For example, you can use the [FuelPHP Validation package], without needing to use the FuelPHP framework itself. * [Aura] +* CakePHP Components + * [Collection] + * [Database] + * [Datasource] + * [Event] + * [I18n] + * [ORM] * [FuelPHP] * [Hoa Project] * [Orno] @@ -48,3 +55,9 @@ components best decoupled from the Laravel framework are listed above._ [Eloquent ORM]: https://github.com/illuminate/database [Queue]: https://github.com/illuminate/queue [Illuminate components]: https://github.com/illuminate +[Collection]: https://github.com/cakephp/collection +[Database]: https://github.com/cakephp/database +[Datasource]: https://github.com/cakephp/datasource +[Event]: https://github.com/cakephp/event +[I18n]: https://github.com/cakephp/i18n +[ORM]: https://github.com/cakephp/orm From 131843b5b2e3fe4f938915ed958de7305ae7e314 Mon Sep 17 00:00:00 2001 From: "Brian A. Weston" Date: Thu, 19 Apr 2018 14:19:14 -0700 Subject: [PATCH 088/127] Update Gettext introduction phrasing --- _posts/05-06-01-Internationalization-and-Localization.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/05-06-01-Internationalization-and-Localization.md b/_posts/05-06-01-Internationalization-and-Localization.md index 7e53a5d..9c36dec 100644 --- a/_posts/05-06-01-Internationalization-and-Localization.md +++ b/_posts/05-06-01-Internationalization-and-Localization.md @@ -31,9 +31,9 @@ don't try this if your project will contain more than a couple of pages. The most classic way and often taken as reference for i18n and l10n is a [Unix tool called `gettext`][gettext]. It dates back to 1995 and is still a complete implementation for translating software. It is pretty easy to get running, while -it still sports powerful supporting tools. It's about Gettext we will be talking here. Also, to help you not get messy -over the command-line, we will be presenting a great GUI application that can be used to easily update your l10n source -files. +it still sports powerful supporting tools. We will talk about Gettext in more detail below. If you would prefer to not +have to get your hands dirty with the command line, we will also be presenting a great GUI application that can be used +to easily update your l10n source files. ### Other tools From a1f8e83a3fd9403fec685dfa9cf871bf6c529797 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 1 Jun 2018 16:01:11 +0100 Subject: [PATCH 089/127] Using php 7 feature in example --- _posts/09-02-01-Errors.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_posts/09-02-01-Errors.md b/_posts/09-02-01-Errors.md index c510a70..66befbd 100644 --- a/_posts/09-02-01-Errors.md +++ b/_posts/09-02-01-Errors.md @@ -87,7 +87,8 @@ rewritten like this: {% highlight php %} Date: Mon, 11 Jun 2018 11:43:22 +0100 Subject: [PATCH 090/127] Change Humbug for Infection --- _posts/11-04-01-Complementary-Testing-Tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/11-04-01-Complementary-Testing-Tools.md b/_posts/11-04-01-Complementary-Testing-Tools.md index b7ed173..b797647 100644 --- a/_posts/11-04-01-Complementary-Testing-Tools.md +++ b/_posts/11-04-01-Complementary-Testing-Tools.md @@ -15,7 +15,7 @@ libraries useful for any preferred approach taken. * [Prophecy] is a highly opinionated yet very powerful and flexible PHP object mocking framework. It's integrated with [PHPSpec] and can be used with [PHPUnit]. * [php-mock] is a library to help to mock PHP native functions. -* [Humbug] is a PHP implementation of [Mutation Testing] to help to measure the effectiveness of your tests. +* [Infection] is a PHP implementation of [Mutation Testing] to help to measure the effectiveness of your tests. [Selenium]: http://seleniumhq.org/ @@ -25,5 +25,5 @@ libraries useful for any preferred approach taken. [PHPSpec]: http://www.phpspec.net/ [Prophecy]: https://github.com/phpspec/prophecy [php-mock]: https://github.com/php-mock/php-mock -[Humbug]: https://github.com/padraic/humbug +[Infection]: https://github.com/infection/infection [Mutation Testing]: https://en.wikipedia.org/wiki/Mutation_testing From d25acf38eea18bf06378f5d84262e5c7f8dde5ec Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 11:44:16 -0400 Subject: [PATCH 091/127] Add note about Paragon Initiative security guide --- Gemfile | 2 +- Gemfile.lock | 105 +++++++++++++++++++----------------- _posts/10-01-01-Security.md | 3 ++ 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/Gemfile b/Gemfile index 5bf72b3..259b873 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'github-pages' +gem 'github-pages', group: :jekyll_plugins gem 'rouge' diff --git a/Gemfile.lock b/Gemfile.lock index da11494..ae52d2b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,57 +2,61 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.2.9) - activesupport (5.0.0.1) + activesupport (5.2.0) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.4.0) blankslate (2.1.2.4) - classifier-reborn (2.0.4) + classifier-reborn (2.2.0) fast-stemmer (~> 1.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) colorator (0.1) - concurrent-ruby (1.0.2) - ethon (0.9.1) + concurrent-ruby (1.0.5) + ethon (0.11.0) ffi (>= 1.3.0) execjs (2.7.0) - faraday (0.10.0) + faraday (0.15.2) multipart-post (>= 1.2, < 3) fast-stemmer (1.0.2) - ffi (1.9.14) - ffi (1.9.14-x64-mingw32) + ffi (1.9.25) gemoji (2.1.0) - github-pages (39) + github-pages (43) RedCloth (= 4.2.9) - github-pages-health-check (~> 0.2) + github-pages-health-check (= 0.6.0) jekyll (= 2.4.0) jekyll-coffeescript (= 1.0.1) jekyll-feed (= 0.3.1) + jekyll-gist (= 1.4.0) jekyll-mentions (= 0.2.1) - jekyll-redirect-from (= 0.8.0) + jekyll-paginate (= 1.1.0) + jekyll-redirect-from (= 0.9.1) jekyll-sass-converter (= 1.3.0) - jekyll-sitemap (= 0.8.1) + jekyll-seo-tag (= 0.1.4) + jekyll-sitemap (= 0.9.0) jemoji (= 0.5.0) - kramdown (= 1.5.0) + kramdown (= 1.9.0) liquid (= 2.6.2) maruku (= 0.7.0) mercenary (~> 0.3) pygments.rb (= 0.6.3) - rdiscount (= 2.1.7) - redcarpet (= 3.3.2) + rdiscount (= 2.1.8) + redcarpet (= 3.3.3) terminal-table (~> 1.4) - github-pages-health-check (0.3.2) - net-dns (~> 0.6) + github-pages-health-check (0.6.0) + addressable (~> 2.3) + net-dns (~> 0.8) public_suffix (~> 1.4) typhoeus (~> 0.7) html-pipeline (1.9.0) activesupport (>= 2) nokogiri (~> 1.4) - i18n (0.7.0) + i18n (1.0.1) + concurrent-ruby (~> 1.0) jekyll (2.4.0) classifier-reborn (~> 2.0) colorator (~> 0.1) @@ -77,71 +81,76 @@ GEM html-pipeline (~> 1.9.0) jekyll (~> 2.0) jekyll-paginate (1.1.0) - jekyll-redirect-from (0.8.0) + jekyll-redirect-from (0.9.1) jekyll (>= 2.0) jekyll-sass-converter (1.3.0) sass (~> 3.2) - jekyll-sitemap (0.8.1) - jekyll-watch (1.5.0) - listen (~> 3.0, < 3.1) + jekyll-seo-tag (0.1.4) + jekyll (>= 2.0) + jekyll-sitemap (0.9.0) + jekyll-watch (1.5.1) + listen (~> 3.0) jemoji (0.5.0) gemoji (~> 2.0) html-pipeline (~> 1.9) jekyll (>= 2.0) - kramdown (1.5.0) + kramdown (1.9.0) liquid (2.6.2) - listen (3.0.8) + listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) maruku (0.7.0) mercenary (0.3.6) - mini_portile2 (2.1.0) - minitest (5.9.1) + mini_portile2 (2.3.0) + minitest (5.11.3) multipart-post (2.0.0) net-dns (0.8.0) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - nokogiri (1.6.8.1-x64-mingw32) - mini_portile2 (~> 2.1.0) - octokit (4.6.1) + nokogiri (1.8.3) + mini_portile2 (~> 2.3.0) + octokit (4.9.0) sawyer (~> 0.8.0, >= 0.5.3) parslet (1.5.0) blankslate (~> 2.0) - posix-spawn (0.3.12) + posix-spawn (0.3.13) public_suffix (1.5.3) pygments.rb (0.6.3) posix-spawn (~> 0.3.6) yajl-ruby (~> 1.2.0) - rb-fsevent (0.9.8) - rb-inotify (0.9.7) - ffi (>= 0.5.0) - rdiscount (2.1.7) - redcarpet (3.3.2) - rouge (2.0.7) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rdiscount (2.1.8) + redcarpet (3.3.3) + rouge (3.1.1) + ruby_dep (1.5.0) safe_yaml (1.0.4) - sass (3.4.22) + sass (3.5.6) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) - thread_safe (0.3.5) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) toml (0.1.2) parslet (~> 1.5.0) typhoeus (0.8.0) ethon (>= 0.8.0) - tzinfo (1.2.2) + tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.1.1) - yajl-ruby (1.2.1) + unicode-display_width (1.4.0) + yajl-ruby (1.2.3) PLATFORMS ruby - x64-mingw32 DEPENDENCIES github-pages rouge BUNDLED WITH - 1.13.6 + 1.16.2 diff --git a/_posts/10-01-01-Security.md b/_posts/10-01-01-Security.md index c8e3b48..cf553ad 100644 --- a/_posts/10-01-01-Security.md +++ b/_posts/10-01-01-Security.md @@ -3,3 +3,6 @@ anchor: security --- # Security {#security_title} + +The best resource I've found on PHP security is [The 2018 Guide to Building Secure PHP Software](https://paragonie.com/blog/2017/12/2018-guide-building-secure-php-software) by +[Paragon Initiative](https://paragonie.com/). From 8133128d4af2f3075c028e5e1ef05a3823c91936 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 11:47:07 -0400 Subject: [PATCH 092/127] Bump PHP version number --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 8 ++++---- 1 file changed, 4 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 caed092..d60b096 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -4,13 +4,13 @@ isChild: true anchor: use_the_current_stable_version --- -## Use the Current Stable Version (7.1) {#use_the_current_stable_version_title} +## Use the Current Stable Version (7.2) {#use_the_current_stable_version_title} -If you are getting started with PHP, start with the current stable release of [PHP 7.1][php-release]. PHP 7.1 is very +If you are getting started with PHP, start with the current stable release of [PHP 7.2][php-release]. PHP 7.2 is very new, and adds many amazing [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. -Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php71-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. +Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php72-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. [php-release]: http://php.net/downloads.php [php-docs]: http://php.net/manual/ -[php71-bc]: http://php.net/manual/migration71.incompatible.php +[php72-bc]: http://php.net/manual/migration72.incompatible.php From d94d387b56b82d74d4a93b23eec71ebe70805485 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 11:48:15 -0400 Subject: [PATCH 093/127] Bump PHP version number --- _posts/01-02-01-Use-the-Current-Stable-Version.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d60b096..a5db8d9 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -1,5 +1,5 @@ --- -title: Use the Current Stable Version (7.1) +title: Use the Current Stable Version (7.2) isChild: true anchor: use_the_current_stable_version --- From 7d9e4ad5ea0103a065a7294ae14aafa13a9d71eb Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 11:57:32 -0400 Subject: [PATCH 094/127] Delete CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 182118a..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -www.phptherightway.com From bde7163132eec8808f04828548ecd72dc85149e2 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 11:57:37 -0400 Subject: [PATCH 095/127] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..bf46d9b --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +www.phptherightway.com \ No newline at end of file From afa6718501512091c48bed80c0922c10f95e4dde Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 12:56:14 -0400 Subject: [PATCH 096/127] Update macOS Homebrew notes --- ...01-02-01-Use-the-Current-Stable-Version.md | 5 ++-- _posts/01-04-01-Mac-Setup.md | 26 +++++++++---------- 2 files changed, 14 insertions(+), 17 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 a5db8d9..8d49377 100644 --- a/_posts/01-02-01-Use-the-Current-Stable-Version.md +++ b/_posts/01-02-01-Use-the-Current-Stable-Version.md @@ -6,10 +6,9 @@ anchor: use_the_current_stable_version ## Use the Current Stable Version (7.2) {#use_the_current_stable_version_title} -If you are getting started with PHP, start with the current stable release of [PHP 7.2][php-release]. PHP 7.2 is very -new, and adds many amazing [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. +If you are getting started with PHP, start with the current stable release of [PHP 7.2][php-release]. PHP 7.x adds many [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions. -Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php72-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. +You should try to upgrade to the latest stable version quickly - PHP 5.6 [will not receive security updates beyond 2018](http://php.net/supported-versions.php). Upgrading is easy, as there are not many [backwards compatibility breaks][php72-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. [php-release]: http://php.net/downloads.php [php-docs]: http://php.net/manual/ diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index dc06ddf..2a2fb35 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -5,18 +5,17 @@ anchor: mac_setup ## Mac Setup {#mac_setup_title} -OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mavericks has 5.4.17, -Yosemite 5.5.9, El Capitan 5.5.29 and Sierra 5.6.24, but with PHP 7.1 out that is often not good enough. - -There are multiple ways to install PHP on OS X. +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. ### Install PHP via Homebrew -[Homebrew] is a powerful package manager for OS X, which can help you install PHP and various extensions easily. -[Homebrew PHP] is a repository that contains PHP-related "formulae" for Homebrew, and will let you install PHP. +[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, and 7.2. Install the latest version with this command: -At this point, you can install `php53`, `php54`, `php55`, `php56`, `php70` or `php71` using the `brew install` command, and switch -between them by modifying your `PATH` variable. Alternatively, you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you. +``` +brew install php@7.2 +``` + +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. ### Install PHP via Macports @@ -60,15 +59,14 @@ The solutions listed above mainly handle PHP itself, and do not supply things li "All-in-one" solutions such as [MAMP][mamp-downloads] and [XAMPP][xampp] will install these other bits of software for you and tie them all together, but ease of setup comes with a trade-off of flexibility. - -[Homebrew]: http://brew.sh/ +[Homebrew]: https://brew.sh/ [Homebrew PHP]: https://github.com/Homebrew/homebrew-php#installation [MacPorts]: https://www.macports.org/install.php [phpbrew]: https://github.com/phpbrew/phpbrew -[php-osx.liip.ch]: http://php-osx.liip.ch/ -[mac-compile]: http://php.net/install.macosx.compile +[php-osx.liip.ch]: https://php-osx.liip.ch/ +[mac-compile]: https://secure.php.net/install.macosx.compile [xcode-gcc-substitution]: https://github.com/kennethreitz/osx-gcc-installer ["Command Line Tools for XCode"]: https://developer.apple.com/downloads -[mamp-downloads]: http://www.mamp.info/en/downloads/ -[xampp]: http://www.apachefriends.org/en/xampp.html +[mamp-downloads]: https://www.mamp.info/en/downloads/ +[xampp]: https://www.apachefriends.org/index.html [brew-php-switcher]: https://github.com/philcook/brew-php-switcher From 4fd12a474258386c10316bfe0425cfbb59dd300b Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:04:28 -0400 Subject: [PATCH 097/127] Remove deprecated PSR0 from code style section --- _posts/02-01-01-Code-Style-Guide.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 65e7bb5..2497cb7 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -10,7 +10,7 @@ PHP developers to choose several of these and combine them into a single project their projects. The [Framework Interop Group][fig] has proposed and approved a series of style recommendations. Not all of them related -to code-style, but those that do are [PSR-0][psr0], [PSR-1][psr1], [PSR-2][psr2] and [PSR-4][psr4]. These +to code-style, but those that do are [PSR-1][psr1], [PSR-2][psr2] and [PSR-4][psr4]. These recommendations are merely a set of rules that many projects like Drupal, Zend, Symfony, Laravel, CakePHP, phpBB, AWS SDK, FuelPHP, Lithium, etc are adopting. You can use them for your own projects, or continue to use your own personal style. @@ -19,7 +19,6 @@ Ideally, you should write PHP code that adheres to a known standard. This could of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, and applications that implement the components can have consistency even when working with lots of third-party code. -* [Read about PSR-0][psr0] * [Read about PSR-1][psr1] * [Read about PSR-2][psr2] * [Read about PSR-4][psr4] @@ -57,14 +56,13 @@ English is preferred for all symbol names and code infrastructure. Comments may readable by all current and future parties who may be working on the codebase. -[fig]: http://www.php-fig.org/ -[psr0]: http://www.php-fig.org/psr/psr-0/ -[psr1]: http://www.php-fig.org/psr/psr-1/ -[psr2]: http://www.php-fig.org/psr/psr-2/ -[psr4]: http://www.php-fig.org/psr/psr-4/ -[pear-cs]: http://pear.php.net/manual/en/standards.php -[symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html -[phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ +[fig]: https://www.php-fig.org/ +[psr1]: https://www.php-fig.org/psr/psr-1/ +[psr2]: https://www.php-fig.org/psr/psr-2/ +[psr4]: https://www.php-fig.org/psr/psr-4/ +[pear-cs]: https://pear.php.net/manual/en/standards.php +[symfony-cs]: https://symfony.com/doc/current/contributing/code/standards.html +[phpcs]: https://pear.php.net/package/PHP_CodeSniffer/ [phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs -[phpcsfixer]: http://cs.sensiolabs.org/ +[phpcsfixer]: https://cs.sensiolabs.org/ From e0a9956160c86c4bfb3330e6eaba6d454f5c4fb5 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:09:34 -0400 Subject: [PATCH 098/127] Update links to HTTPS in programming paradigms section --- _posts/03-02-01-Programming-Paradigms.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/_posts/03-02-01-Programming-Paradigms.md b/_posts/03-02-01-Programming-Paradigms.md index f971f37..7484c02 100644 --- a/_posts/03-02-01-Programming-Paradigms.md +++ b/_posts/03-02-01-Programming-Paradigms.md @@ -50,14 +50,14 @@ available as `__call()` and `__callStatic()`. * [Read about Overloading][overloading] -[oop]: http://php.net/language.oop5 -[traits]: http://php.net/language.oop5.traits -[anonymous-functions]: http://php.net/functions.anonymous -[closure-class]: http://php.net/class.closure +[oop]: https://secure.php.net/language.oop5 +[traits]: https://secure.php.net/language.oop5.traits +[anonymous-functions]: https://secure.php.net/functions.anonymous +[closure-class]: https://secure.php.net/class.closure [closures-rfc]: https://wiki.php.net/rfc/closures -[callables]: http://php.net/language.types.callable -[call-user-func-array]: http://php.net/function.call-user-func-array -[magic-methods]: http://php.net/language.oop5.magic -[reflection]: http://php.net/intro.reflection -[overloading]: http://php.net/language.oop5.overloading +[callables]: https://secure.php.net/language.types.callable +[call-user-func-array]: https://secure.php.net/function.call-user-func-array +[magic-methods]: https://secure.php.net/language.oop5.magic +[reflection]: https://secure.php.net/intro.reflection +[overloading]: https://secure.php.net/language.oop5.overloading From 172a25f913c997011be6a66314ddcc74a7076fe6 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:11:36 -0400 Subject: [PATCH 099/127] Update links to HTTPS in namespaces and SPL sections --- _posts/03-03-01-Namespaces.md | 6 +++--- _posts/03-04-01-Standard-PHP-Library.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index f821dad..64261fd 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -28,6 +28,6 @@ If you're going to use an autoloader standard for a new application or package, * [Read about PSR-4][psr4] -[namespaces]: http://php.net/language.namespaces -[psr0]: http://www.php-fig.org/psr/psr-0/ -[psr4]: http://www.php-fig.org/psr/psr-4/ +[namespaces]: https://secure.php.net/language.namespaces +[psr0]: https://www.php-fig.org/psr/psr-0/ +[psr4]: https://www.php-fig.org/psr/psr-4/ diff --git a/_posts/03-04-01-Standard-PHP-Library.md b/_posts/03-04-01-Standard-PHP-Library.md index 6275976..57e845b 100644 --- a/_posts/03-04-01-Standard-PHP-Library.md +++ b/_posts/03-04-01-Standard-PHP-Library.md @@ -14,5 +14,5 @@ over these datastructures or your own classes which implement SPL interfaces. * [SPL video course on Lynda.com(Paid)][spllynda] -[spl]: http://php.net/book.spl -[spllynda]: http://www.lynda.com/PHP-tutorials/Up-Running-Standard-PHP-Library/175038-2.html +[spl]: https://secure.php.net/book.spl +[spllynda]: https://www.lynda.com/PHP-tutorials/Up-Running-Standard-PHP-Library/175038-2.html From 522c7c5454dc77018016848e8a24a9a89ad6d398 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:14:57 -0400 Subject: [PATCH 100/127] Update links to use HTTPS in CLI section Remove bad link to Windows CLI setup --- _posts/03-05-01-Command-Line-Interface.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/_posts/03-05-01-Command-Line-Interface.md b/_posts/03-05-01-Command-Line-Interface.md index 825e1c3..f03345d 100644 --- a/_posts/03-05-01-Command-Line-Interface.md +++ b/_posts/03-05-01-Command-Line-Interface.md @@ -52,13 +52,10 @@ Hello, world * [Learn about running PHP from the command line][php-cli] - * [Learn about setting up Windows to run PHP from the command line][php-cli-windows] - -[phpinfo]: http://php.net/function.phpinfo -[cli-options]: http://php.net/features.commandline.options -[argc]: http://php.net/reserved.variables.argc -[argv]: http://php.net/reserved.variables.argv -[exit-codes]: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits -[php-cli]: http://php.net/features.commandline -[php-cli-windows]: http://php.net/install.windows.commandline +[phpinfo]: https://secure.php.net/function.phpinfo +[cli-options]: https://secure.php.net/features.commandline.options +[argc]: https://secure.php.net/reserved.variables.argc +[argv]: https://secure.php.net/reserved.variables.argv +[exit-codes]: https://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits +[php-cli]: https://secure.php.net/features.commandline.options From 9b6dbc302b8db59bc40891e63b8d85465783e406 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:19:12 -0400 Subject: [PATCH 101/127] Update Xdebug links to use https --- _posts/03-06-01-XDebug.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/03-06-01-XDebug.md b/_posts/03-06-01-XDebug.md index e5de055..ae29790 100644 --- a/_posts/03-06-01-XDebug.md +++ b/_posts/03-06-01-XDebug.md @@ -41,6 +41,6 @@ stand-alone Xdebug GUI for Mac. * [Learn more about MacGDBp][macgdbp-install] -[xdebug-install]: http://xdebug.org/docs/install -[xdebug-docs]: http://xdebug.org/docs/ -[macgdbp-install]: http://www.bluestatic.org/software/macgdbp/ +[xdebug-install]: https://xdebug.org/docs/install +[xdebug-docs]: https://xdebug.org/docs/ +[macgdbp-install]: https://www.bluestatic.org/software/macgdbp/ From ae37a768d08787fe97e03039ba08d9207be9a0d7 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:28:42 -0400 Subject: [PATCH 102/127] Update Composer install section, let links use https --- _posts/04-02-01-Composer-and-Packagist.md | 70 ++++++----------------- 1 file changed, 19 insertions(+), 51 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index bd4d831..24c94b4 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -6,20 +6,20 @@ anchor: composer_and_packagist ## Composer and Packagist {#composer_and_packagist_title} -Composer is a **brilliant** dependency manager for PHP. List your project's dependencies in a `composer.json` file and, +Composer is the recommended dependency manager for PHP. List your project's dependencies in a `composer.json` file and, with a few simple commands, Composer will automatically download your project's dependencies and setup autoloading for you. Composer is analogous to NPM in the node.js world, or Bundler in the Ruby world. -There are already a lot of PHP libraries that are compatible with Composer, ready to be used in your project. These +There is a plethora of PHP libraries that are compatible with Composer and ready to be used in your project. These "packages" are listed on [Packagist], the official repository for Composer-compatible PHP libraries. ### How to Install Composer -The safest way to download composer is by [following the official instructions](https://getcomposer.org/download/). -This will verify the installer is not corrupt or tampered with. -The installer installs Composer *locally*, in your current working directory. +The safest way to download composer is by [following the official instructions](https://getcomposer.org/download/). +This will verify the installer is not corrupt or tampered with. +The installer installs a `composer.phar` binary in your _current working directory_. -We recommend installing it *globally* (e.g. a single copy in /usr/local/bin) - to do so, run this afterwards: +We recommend installing Composer *globally* (e.g. a single copy in `/usr/local/bin`). To do so, run this command next: {% highlight console %} mv composer.phar /usr/local/bin/composer @@ -35,42 +35,10 @@ For Windows users the easiest way to get up and running is to use the [ComposerS performs a global install and sets up your `$PATH` so that you can just call `composer` from any directory in your command line. -### How to Install Composer (manually) - -Manually installing Composer is an advanced technique; however, there are various reasons why a -developer might prefer this method vs. using the interactive installation routine. The interactive -installation checks your PHP installation to ensure that: - -- a sufficient version of PHP is being used -- `.phar` files can be executed correctly -- certain directory permissions are sufficient -- certain problematic extensions are not loaded -- certain `php.ini` settings are set - -Since a manual installation performs none of these checks, you have to decide whether the trade-off is -worth it for you. As such, below is how to obtain Composer manually: - -{% highlight console %} -curl -s https://getcomposer.org/composer.phar -o $HOME/local/bin/composer -chmod +x $HOME/local/bin/composer -{% endhighlight %} - -The path `$HOME/local/bin` (or a directory of your choice) should be in your `$PATH` environment -variable. This will result in a `composer` command being available. - -When you come across documentation that states to run Composer as `php composer.phar install`, you can -substitute that with: - -{% highlight console %} -composer install -{% endhighlight %} - -This section will assume you have installed composer globally. - ### How to Define and Install Dependencies Composer keeps track of your project's dependencies in a file called `composer.json`. You can manage it -by hand if you like, or use Composer itself. The `composer require` command adds a project dependency +by hand if you like, or use Composer itself. The `composer require` command adds a project dependency and if you don't have a `composer.json` file, one will be created. Here's an example that adds [Twig] as a dependency of your project. @@ -80,14 +48,14 @@ composer require twig/twig:~1.8 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 +download and install your dependencies into the `vendor/` directory. This also applies to projects you've downloaded that already provide a `composer.json` file: {% highlight console %} composer install {% endhighlight %} -Next, add this line to your application's primary PHP file; this will tell PHP to use Composer's +Next, add this line to your application's primary PHP file; this will tell PHP to use Composer's autoloader for your project dependencies. {% highlight php %} @@ -100,14 +68,14 @@ Now you can use your project dependencies, and they'll be autoloaded on demand. ### Updating your dependencies Composer creates a file called `composer.lock` which stores the exact version of each package it -downloaded when you first ran `composer install`. If you share your project with others, -ensure the `composer.lock` file is included, so that when they run `composer install` they'll -get the same versions as you. To update your dependencies, run `composer update`. Don't use -`composer update` when deploying, only `composer install`, otherwise you may end up with different +downloaded when you first ran `composer install`. If you share your project with others, +ensure the `composer.lock` file is included, so that when they run `composer install` they'll +get the same versions as you. To update your dependencies, run `composer update`. Don't use +`composer update` when deploying, only `composer install`, otherwise you may end up with different package versions on production. 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 +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. @@ -125,7 +93,7 @@ file and tell you if you need to update any of your dependencies. ### Handling global dependencies with Composer Composer can also handle global dependencies and their binaries. Usage is straight-forward, all you need -to do is prefix your command with `global`. If for example you wanted to install PHPUnit and have it +to do is prefix your command with `global`. If for example you wanted to install PHPUnit and have it available globally, you'd run the following command: {% highlight console %} @@ -133,14 +101,14 @@ composer global require phpunit/phpunit {% endhighlight %} This will create a `~/.composer` folder where your global dependencies reside. To have the installed -packages' binaries available everywhere, you'd then add the `~/.composer/vendor/bin` folder to your +packages' binaries available everywhere, you'd then add the `~/.composer/vendor/bin` folder to your `$PATH` variable. * [Learn about Composer] -[Packagist]: http://packagist.org/ -[Twig]: http://twig.sensiolabs.org +[Packagist]: https://packagist.org/ +[Twig]: https://twig.symfony.com/ [VersionEye]: https://www.versioneye.com/ [Security Advisories Checker]: https://security.sensiolabs.org/ -[Learn about Composer]: http://getcomposer.org/doc/00-intro.md +[Learn about Composer]: https://getcomposer.org/doc/00-intro.md [ComposerSetup]: https://getcomposer.org/Composer-Setup.exe From e28e6a9171497feb1138563657a56b38a26f6101 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:30:52 -0400 Subject: [PATCH 103/127] Update examples in Composer usage section --- _posts/04-02-01-Composer-and-Packagist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index 24c94b4..4d59671 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -43,7 +43,7 @@ and if you don't have a `composer.json` file, one will be created. Here's an exa as a dependency of your project. {% highlight console %} -composer require twig/twig:~1.8 +composer require twig/twig:^2.0 {% endhighlight %} Alternatively, the `composer init` command will guide you through creating a full `composer.json` file From ca27935c8c82ce97e01aa6dc3159f0734d54e66b Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:34:42 -0400 Subject: [PATCH 104/127] Update PEAR links, let them use https --- _posts/04-03-01-PEAR.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index 4410218..443d94a 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -18,10 +18,10 @@ version conflicts between two projects arise. ### How to install PEAR -You can install PEAR by downloading the `.phar` installer and executing it. The PEAR documentation has +You can install PEAR by downloading the `.phar` installer and executing it. The PEAR documentation has detailed [install instructions][2] for every operating system. -If you are using Linux, you can also have a look at your distribution package manager. Debian and Ubuntu, +If you are using Linux, you can also have a look at your distribution package manager. Debian and Ubuntu, for example, have an apt `php-pear` package. ### How to install a package @@ -47,7 +47,7 @@ handle your PEAR dependencies. This example will install code from `pear2.php.ne "repositories": [ { "type": "pear", - "url": "http://pear2.php.net" + "url": "https://pear2.php.net" } ], "require": { @@ -80,9 +80,9 @@ $request = new pear2\HTTP\Request(); * [Learn more about using PEAR with Composer][6] -[1]: http://pear.php.net/ -[2]: http://pear.php.net/manual/en/installation.getting.php -[3]: http://pear.php.net/packages.php -[4]: http://pear.php.net/manual/en/guide.users.commandline.channels.php +[1]: https://pear.php.net/ +[2]: https://pear.php.net/manual/installation.getting.php +[3]: https://pear.php.net/packages.php +[4]: https://pear.php.net/manual/guide.users.commandline.channels.php [5]: /#composer_and_packagist -[6]: http://getcomposer.org/doc/05-repositories.md#pear +[6]: https://getcomposer.org/doc/05-repositories.md#pear From 0d158d2e897a2ec907f3b120771270c18aa4927d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:39:25 -0400 Subject: [PATCH 105/127] Update DateTime links to use https --- _posts/05-03-01-Date-and-Time.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/05-03-01-Date-and-Time.md b/_posts/05-03-01-Date-and-Time.md index 499d074..83d4373 100644 --- a/_posts/05-03-01-Date-and-Time.md +++ b/_posts/05-03-01-Date-and-Time.md @@ -61,10 +61,10 @@ foreach ($periodIterator as $date) { } {% endhighlight %} -A popular PHP API extension is [Carbon](http://carbon.nesbot.com). It inherits everything in the DateTime class, so involves minimal code alterations, but extra features include Localization support, further ways to add, subtract and format a DateTime object, plus a means to test your code by simulating a date and time of your choosing. +A popular PHP API extension is [Carbon](https://carbon.nesbot.com/). It inherits everything in the DateTime class, so involves minimal code alterations, but extra features include Localization support, further ways to add, subtract and format a DateTime object, plus a means to test your code by simulating a date and time of your choosing. * [Read about DateTime][datetime] * [Read about date formatting][dateformat] (accepted date format string options) -[datetime]: http://php.net/book.datetime -[dateformat]: http://php.net/function.date +[datetime]: https://secure.php.net/book.datetime +[dateformat]: https://secure.php.net/function.date From 5decaf9bbbfc2c95a4c1a1f6d4a21b2d5306c67d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 13:51:05 -0400 Subject: [PATCH 106/127] Update UTF8 links to use https, remove broken links --- _posts/05-05-01-PHP-and-UTF8.md | 56 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/_posts/05-05-01-PHP-and-UTF8.md b/_posts/05-05-01-PHP-and-UTF8.md index b734d3b..c2d4af9 100644 --- a/_posts/05-05-01-PHP-and-UTF8.md +++ b/_posts/05-05-01-PHP-and-UTF8.md @@ -6,7 +6,7 @@ anchor: php_and_utf8 ## Working with UTF-8 {#php_and_utf8_title} -_This section was originally written by [Alex Cabal](https://alexcabal.com/) over at +_This section was originally written by [Alex Cabal](https://alexcabal.com/) over at [PHP Best Practices](https://phpbestpractices.org/#utf-8) and has been used as the basis for our own UTF-8 advice_. ### There's no one-liner. Be careful, detailed, and consistent. @@ -44,7 +44,7 @@ Finally, If you are building a distributed application and cannot be certain tha enabled, then consider using the [patchwork/utf8] Composer package. This will use `mbstring` if it is available, and fall back to non UTF-8 functions if not. -[Multibyte String Extension]: http://php.net/book.mbstring +[Multibyte String Extension]: https://secure.php.net/book.mbstring [patchwork/utf8]: https://packagist.org/packages/patchwork/utf8 ### UTF-8 at the Database level @@ -72,17 +72,17 @@ actually [much faster](https://developers.google.com/speed/docs/best-practices/r false ) ); - + // Store our transformed string as UTF-8 in our database // Your DB and tables are in the utf8mb4 character set and collation, right? $handle = $link->prepare('insert into ElvishSentences (Id, Body) values (?, ?)'); $handle->bindValue(1, 1, PDO::PARAM_INT); $handle->bindValue(2, $string); $handle->execute(); - + // Retrieve the string we just stored to prove it was stored correctly $handle = $link->prepare('select * from ElvishSentences where Id = ?'); $handle->bindValue(1, 1, PDO::PARAM_INT); $handle->execute(); - + // Store the result into an object that we'll output later in our HTML $result = $handle->fetchAll(\PDO::FETCH_OBJ); @@ -130,23 +130,21 @@ header('Content-Type: text/html; charset=UTF-8'); ### Further reading -* [PHP Manual: String Operations](http://php.net/language.operators.string) -* [PHP Manual: String Functions](http://php.net/ref.strings) - * [`strpos()`](http://php.net/function.strpos) - * [`strlen()`](http://php.net/function.strlen) - * [`substr()`](http://php.net/function.substr) -* [PHP Manual: Multibyte String Functions](http://php.net/ref.mbstring) - * [`mb_strpos()`](http://php.net/function.mb-strpos) - * [`mb_strlen()`](http://php.net/function.mb-strlen) - * [`mb_substr()`](http://php.net/function.mb-substr) - * [`mb_internal_encoding()`](http://php.net/function.mb-internal-encoding) - * [`mb_http_output()`](http://php.net/function.mb-http-output) - * [`htmlentities()`](http://php.net/function.htmlentities) - * [`htmlspecialchars()`](http://php.net/function.htmlspecialchars) -* [PHP UTF-8 Cheatsheet](http://blog.loftdigital.com/blog/php-utf-8-cheatsheet) -* [Handling UTF-8 with PHP](http://www.phpwact.org/php/i18n/utf-8) -* [Stack Overflow: What factors make PHP Unicode-incompatible?](http://stackoverflow.com/questions/571694/what-factors-make-php-unicode-incompatible) -* [Stack Overflow: Best practices in PHP and MySQL with international strings](http://stackoverflow.com/questions/140728/best-practices-in-php-and-mysql-with-international-strings) -* [How to support full Unicode in MySQL databases](http://mathiasbynens.be/notes/mysql-utf8mb4) -* [Bringing Unicode to PHP with Portable UTF-8](http://www.sitepoint.com/bringing-unicode-to-php-with-portable-utf8/) -* [Stack Overflow: DOMDocument loadHTML does not encode UTF-8 correctly](http://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly) +* [PHP Manual: String Operations](https://secure.php.net/language.operators.string) +* [PHP Manual: String Functions](https://secure.php.net/ref.strings) + * [`strpos()`](https://secure.php.net/function.strpos) + * [`strlen()`](https://secure.php.net/function.strlen) + * [`substr()`](https://secure.php.net/function.substr) +* [PHP Manual: Multibyte String Functions](https://secure.php.net/ref.mbstring) + * [`mb_strpos()`](https://secure.php.net/function.mb-strpos) + * [`mb_strlen()`](https://secure.php.net/function.mb-strlen) + * [`mb_substr()`](https://secure.php.net/function.mb-substr) + * [`mb_internal_encoding()`](https://secure.php.net/function.mb-internal-encoding) + * [`mb_http_output()`](https://secure.php.net/function.mb-http-output) + * [`htmlentities()`](https://secure.php.net/function.htmlentities) + * [`htmlspecialchars()`](https://secure.php.net/function.htmlspecialchars) +* [Stack Overflow: What factors make PHP Unicode-incompatible?](https://stackoverflow.com/questions/571694/what-factors-make-php-unicode-incompatible) +* [Stack Overflow: Best practices in PHP and MySQL with international strings](https://stackoverflow.com/questions/140728/best-practices-in-php-and-mysql-with-international-strings) +* [How to support full Unicode in MySQL databases](https://mathiasbynens.be/notes/mysql-utf8mb4) +* [Bringing Unicode to PHP with Portable UTF-8](https://www.sitepoint.com/bringing-unicode-to-php-with-portable-utf8/) +* [Stack Overflow: DOMDocument loadHTML does not encode UTF-8 correctly](https://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly) From 2eca59c891e0c0f293147c7bcb55c50370b87834 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:05:05 -0400 Subject: [PATCH 107/127] Update internationalization links --- ...1-Internationalization-and-Localization.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/_posts/05-06-01-Internationalization-and-Localization.md b/_posts/05-06-01-Internationalization-and-Localization.md index 7e53a5d..964323d 100644 --- a/_posts/05-06-01-Internationalization-and-Localization.md +++ b/_posts/05-06-01-Internationalization-and-Localization.md @@ -17,8 +17,8 @@ need some huge changes in the source! - **Localization** happens when you adapt the interface (mainly) by translating contents, based on the i18n work done before. It usually is done every time a new language or region needs support and is updated when new interface pieces are added, as they need to be available in all supported languages. -- **Pluralization** defines the rules needed between different languages to interoperate strings containing numbers and -counters. For instance, in English when you have only one item, it's singular, and anything different from that is +- **Pluralization** defines the rules needed between different languages to interoperate strings containing numbers and +counters. For instance, in English when you have only one item, it's singular, and anything different from that is called plural; plural in this language is indicated by adding an S after some words, and sometimes changes parts of it. In other languages, such as Russian or Serbian, there are two plural forms in addition to the singular - you may even find languages with a total of four, five or six forms, such as Slovenian, Irish or Arabic. @@ -38,7 +38,7 @@ files. ### Other tools There are common libraries used that support Gettext and other implementations of i18n. Some of them may seem easier to -install or sport additional features or i18n file formats. In this document, we focus on the tools provided with the +install or sport additional features or i18n file formats. In this document, we focus on the tools provided with the PHP core, but here we list others for completion: - [oscarotero/Gettext][oscarotero]: Gettext support with an OO interface; includes improved helper functions, powerful @@ -82,14 +82,14 @@ files are not mandatory: depending on the tool you're using to do l10n, you can You'll always have one pair of PO/MO files per language and region, but only one POT per domain. ### Domains -There are some cases, in big projects, where you might need to separate translations when the same words convey +There are some cases, in big projects, where you might need to separate translations when the same words convey different meaning given a context. In those cases, you split them into different _domains_. They're basically named groups of POT/PO/MO files, where the filename is the said _translation domain_. Small and medium-sized projects usually, -for simplicity, use only one domain; its name is arbitrary, but we will be using "main" for our code samples. +for simplicity, use only one domain; its name is arbitrary, but we will be using "main" for our code samples. In [Symfony] projects, for example, domains are used to separate the translation for validation messages. #### Locale code -A locale is simply a code that identifies one version of a language. It's defined following the [ISO 639-1][639-1] and +A locale is simply a code that identifies one version of a language. It's defined following the [ISO 639-1][639-1] and [ISO 3166-1 alpha-2][3166-1] specs: two lower-case letters for the language, optionally followed by an underline and two upper-case letters identifying the country or regional code. For [rare languages][rare], three letters are used. @@ -175,7 +175,7 @@ The first section works like a header, having the `msgid` and `msgstr` especiall plural forms and other things that are less relevant. The second section translates a simple string from English to Brazilian Portuguese, and the third does the same, but leveraging string replacement from [`sprintf`][sprintf] so the -translation may contain the user name and visit date. +translation may contain the user name and visit date. The last section is a sample of pluralization forms, displaying the singular and plural version as `msgid` in English and their corresponding translations as `msgstr` 0 and 1 (following the number given by the plural rule). There, string replacement is used as well so the number can be seen @@ -189,8 +189,8 @@ translated `msgstr` lines. Talking about translation keys, there are two main "schools" here: -1. _`msgid` as a real sentence_. - The main advantages are: +1. _`msgid` as a real sentence_. + The main advantages are: - if there are pieces of the software untranslated in any given language, the key displayed will still maintain some meaning. Example: if you happen to translate by heart from English to Spanish but need help to translate to French, you might publish the new page with missing French sentences, and parts of the website would be displayed in English @@ -201,7 +201,7 @@ Talking about translation keys, there are two main "schools" here: - The only disadvantage: if you need to change the actual text, you would need to replace the same `msgid` across several language files. -2. _`msgid` as a unique, structured key_. +2. _`msgid` as a unique, structured key_. It would describe the sentence role in the application in a structured way, including the template or part where the string is located instead of its content. - it's a great way to have the code organized, separating the text content from the template logic. @@ -338,7 +338,7 @@ As you may have noticed before, there are two main types of localized strings: s forms. The first ones have simply two boxes: source and localized string. The source string can't be modified as Gettext/Poedit do not include the powers to alter your source files - you should change the source itself and rescan the files. Tip: you may right-click a translation line and it will hint you with the source files and lines where that -string is being used. +string is being used. On the other hand, plural form strings include two boxes to show the two source strings, and tabs so you can configure the different final forms. @@ -386,7 +386,7 @@ After including those new rules in the `.po` file, a new scan will bring in your * [Wikipedia: i18n and l10n](https://en.wikipedia.org/wiki/Internationalization_and_localization) * [Wikipedia: Gettext](https://en.wikipedia.org/wiki/Gettext) * [LingoHub: PHP internationalization with gettext tutorial][lingohub] -* [PHP Manual: Gettext](http://php.net/manual/en/book.gettext.php) +* [PHP Manual: Gettext](https://secure.php.net/manual/book.gettext.php) * [Gettext Manual][manual] [Poedit]: https://poedit.net @@ -395,22 +395,22 @@ After including those new rules in the `.po` file, a new scan will bring in your [lingohub_plurals]: https://lingohub.com/blog/2013/07/php-internationalization-with-gettext-tutorial/#Plurals [plural]: http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html [gettext]: https://en.wikipedia.org/wiki/Gettext -[manual]: http://www.gnu.org/software/gettext/manual/gettext.html +[manual]: https://www.gnu.org/software/gettext/manual/gettext.html [639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -[3166-1]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 -[rare]: http://www.gnu.org/software/gettext/manual/gettext.html#Rare-Language-Codes +[3166-1]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +[rare]: https://www.gnu.org/software/gettext/manual/gettext.html#Rare-Language-Codes [func_format]: https://www.gnu.org/software/gettext/manual/gettext.html#Language-specific-options [oscarotero]: https://github.com/oscarotero/Gettext [symfony]: https://symfony.com/doc/current/components/translation.html [zend]: https://docs.zendframework.com/zend-i18n/translation [laravel]: https://laravel.com/docs/master/localization -[yii]: http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html -[intl]: http://br2.php.net/manual/en/intro.intl.php +[yii]: https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n +[intl]: https://secure.php.net/manual/intro.intl.php [ICU project]: http://www.icu-project.org [symfony-keys]: https://symfony.com/doc/current/components/translation/usage.html#creating-translations -[sprintf]: http://php.net/manual/en/function.sprintf.php -[func]: http://php.net/manual/en/function.gettext.php -[n_func]: http://php.net/manual/en/function.ngettext.php -[d_func]: http://php.net/manual/en/function.dgettext.php -[dn_func]: http://php.net/manual/en/function.dngettext.php +[sprintf]: https://secure.php.net/manual/function.sprintf.php +[func]: https://secure.php.net/manual/function.gettext.php +[n_func]: https://secure.php.net/manual/function.ngettext.php +[d_func]: https://secure.php.net/manual/function.dgettext.php +[dn_func]: https://secure.php.net/manual/function.dngettext.php From 402f3f4030f733c7352f85ffb01b2368d844f532 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:09:17 -0400 Subject: [PATCH 108/127] Update DI links --- _posts/06-01-01-Dependency-Injection.md | 4 ++-- _posts/06-05-01-Further-Reading.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/06-01-01-Dependency-Injection.md b/_posts/06-01-01-Dependency-Injection.md index de77179..0db3cb7 100644 --- a/_posts/06-01-01-Dependency-Injection.md +++ b/_posts/06-01-01-Dependency-Injection.md @@ -5,9 +5,9 @@ anchor: dependency_injection # Dependency Injection {#dependency_injection_title} -From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): +From [Wikipedia](https://wikipedia.org/wiki/Dependency_injection): -> Dependency injection is a software design pattern that allows the removal of hard-coded dependencies and makes it +> Dependency injection is a software design pattern that allows the removal of hard-coded dependencies and makes it > possible to change them, whether at run-time or compile-time. This quote makes the concept sound much more complicated than it actually is. Dependency Injection is providing a diff --git a/_posts/06-05-01-Further-Reading.md b/_posts/06-05-01-Further-Reading.md index f9553b4..8545a80 100644 --- a/_posts/06-05-01-Further-Reading.md +++ b/_posts/06-05-01-Further-Reading.md @@ -8,5 +8,5 @@ anchor: further_reading * [Learning about Dependency Injection and PHP](http://ralphschindler.com/2011/05/18/learning-about-dependency-injection-and-php) * [What is Dependency Injection?](http://fabien.potencier.org/article/11/what-is-dependency-injection) * [Dependency Injection: An analogy](https://mwop.net/blog/260-Dependency-Injection-An-analogy.html) -* [Dependency Injection: Huh?](http://net.tutsplus.com/tutorials/php/dependency-injection-huh/) +* [Dependency Injection: Huh?](https://code.tutsplus.com/tutorials/dependency-injection-huh--net-26903) * [Dependency Injection as a tool for testing](https://medium.com/philipobenito/dependency-injection-as-a-tool-for-testing-902c21c147f1) From b3eed1117d0caa1bf45d198d47f53292c9f26a0d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:12:15 -0400 Subject: [PATCH 109/127] Use external resource for Design Pattern examples --- _posts/05-04-01-Design-Patterns.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_posts/05-04-01-Design-Patterns.md b/_posts/05-04-01-Design-Patterns.md index 4131503..fb86e33 100644 --- a/_posts/05-04-01-Design-Patterns.md +++ b/_posts/05-04-01-Design-Patterns.md @@ -14,4 +14,6 @@ lot of the pattern decisions are made for you. But it is still up to you to pick code you build on top of the framework. If, on the other hand, you are not using a framework to build your application then you have to find the patterns that best suit the type and size of application that you're building. -* Continue reading on [Design Patterns](/pages/Design-Patterns.html) +You can learn more about PHP design patterns and see working examples at: + + From 18e98ecab5de1aa01dd70fa53bd636a6034b088c Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:22:37 -0400 Subject: [PATCH 110/127] Update Database links to use https --- _posts/07-01-01-Databases.md | 6 +++--- _posts/07-02-01-Databases_MySQL.md | 12 ++++++------ _posts/07-03-01-Databases_PDO.md | 6 +++--- _posts/07-04-01-Interacting-via-Code.md | 8 ++++---- _posts/07-05-01-Abstraction-Layers.md | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 362e11f..1c63d48 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -14,6 +14,6 @@ MySQL and a little bit of MSSQL, or you need to connect to an Oracle database, t same drivers. You'll need to learn a brand new API for each database — and that can get silly. -[mysqli]: http://php.net/mysqli -[pgsql]: http://php.net/pgsql -[mssql]: http://php.net/mssql +[mysqli]: https://secure.php.net/mysqli +[pgsql]: https://secure.php.net/pgsql +[mssql]: https://secure.php.net/mssql diff --git a/_posts/07-02-01-Databases_MySQL.md b/_posts/07-02-01-Databases_MySQL.md index 476ffc9..4bdac6a 100644 --- a/_posts/07-02-01-Databases_MySQL.md +++ b/_posts/07-02-01-Databases_MySQL.md @@ -27,10 +27,10 @@ your applications within your own development schedules so you won't be rushed l * [PHP: Choosing an API for MySQL][mysql_api] * [PDO Tutorial for MySQL Developers][pdo4mysql_devs] -[mysql]: http://php.net/mysql -[mysql_deprecated]: http://php.net/migration55.deprecated -[mysql_removed]: http://php.net/manual/en/migration70.removed-exts-sapis.php -[mysqli]: http://php.net/mysqli -[pdo]: http://php.net/pdo -[mysql_api]: http://php.net/mysqlinfo.api.choosing +[mysql]: https://secure.php.net/mysqli +[mysql_deprecated]: https://secure.php.net/migration55.deprecated +[mysql_removed]: https://secure.php.net/manual/migration70.removed-exts-sapis.php +[mysqli]: https://secure.php.net/mysqli +[pdo]: https://secure.php.net/pdo +[mysql_api]: https://secure.php.net/mysqlinfo.api.choosing [pdo4mysql_devs]: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers diff --git a/_posts/07-03-01-Databases_PDO.md b/_posts/07-03-01-Databases_PDO.md index da20237..5c819f0 100644 --- a/_posts/07-03-01-Databases_PDO.md +++ b/_posts/07-03-01-Databases_PDO.md @@ -71,7 +71,7 @@ unless of course you are using persistent connections. * [Learn about PDO connections] -[pdo]: http://php.net/pdo +[pdo]: https://secure.php.net/pdo [SQL Injection]: http://wiki.hashphp.org/Validation -[Learn about PDO]: http://php.net/book.pdo -[Learn about PDO connections]: http://php.net/pdo.connections +[Learn about PDO]: https://secure.php.net/book.pdo +[Learn about PDO connections]: https://secure.php.net/pdo.connections diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index 5cae4f0..a5e3b77 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -48,7 +48,7 @@ logic in and you have a "View", which is very nearly [MVC] - a common OOP archit {% highlight php %} Date: Tue, 19 Jun 2018 14:31:09 -0400 Subject: [PATCH 111/127] Update Templating links to use https --- _posts/08-04-01-Compiled-Templates.md | 6 +++--- _posts/08-05-01-Further-Reading.md | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_posts/08-04-01-Compiled-Templates.md b/_posts/08-04-01-Compiled-Templates.md index 5abba92..41553ba 100644 --- a/_posts/08-04-01-Compiled-Templates.md +++ b/_posts/08-04-01-Compiled-Templates.md @@ -68,7 +68,7 @@ Using the [Twig] library. [article_templating_engines]: http://fabien.potencier.org/article/34/templating-engines-in-php -[Twig]: http://twig.sensiolabs.org/ +[Twig]: https://twig.symfony.com/ [Brainy]: https://github.com/box/brainy -[Smarty]: http://www.smarty.net/ -[Mustache]: http://mustache.github.io/ +[Smarty]: https://www.smarty.net/ +[Mustache]: https://mustache.github.io/ diff --git a/_posts/08-05-01-Further-Reading.md b/_posts/08-05-01-Further-Reading.md index fe80534..7054080 100644 --- a/_posts/08-05-01-Further-Reading.md +++ b/_posts/08-05-01-Further-Reading.md @@ -8,23 +8,23 @@ anchor: templating_further_reading ### Articles & Tutorials * [Templating Engines in PHP](http://fabien.potencier.org/article/34/templating-engines-in-php) -* [An Introduction to Views & Templating in CodeIgniter](http://code.tutsplus.com/tutorials/an-introduction-to-views-templating-in-codeigniter--net-25648) -* [Getting Started With PHP Templating](http://www.smashingmagazine.com/2011/10/17/getting-started-with-php-templating/) -* [Roll Your Own Templating System in PHP](http://code.tutsplus.com/tutorials/roll-your-own-templating-system-in-php--net-16596) +* [An Introduction to Views & Templating in CodeIgniter](https://code.tutsplus.com/tutorials/an-introduction-to-views-templating-in-codeigniter--net-25648) +* [Getting Started With PHP Templating](https://www.smashingmagazine.com/2011/10/getting-started-with-php-templating/) +* [Roll Your Own Templating System in PHP](https://code.tutsplus.com/tutorials/roll-your-own-templating-system-in-php--net-16596) * [Master Pages](https://laracasts.com/series/laravel-from-scratch/episodes/7) -* [Working With Templates in Symfony 2](http://code.tutsplus.com/tutorials/working-with-templates-in-symfony-2--cms-21172) +* [Working With Templates in Symfony 2](https://code.tutsplus.com/tutorials/working-with-templates-in-symfony-2--cms-21172) * [Writing Safer Templates](https://github.com/box/brainy/wiki/Writing-Safe-Templates) ### Libraries * [Aura.View](https://github.com/auraphp/Aura.View) *(native)* -* [Blade](http://laravel.com/docs/blade) *(compiled, framework specific)* +* [Blade](https://laravel.com/docs/blade) *(compiled, framework specific)* * [Brainy](https://github.com/box/brainy) *(compiled)* * [Dwoo](http://dwoo.org/) *(compiled)* * [Latte](https://github.com/nette/latte) *(compiled)* * [Mustache](https://github.com/bobthecow/mustache.php) *(compiled)* -* [PHPTAL](http://phptal.org/) *(compiled)* +* [PHPTAL](https://phptal.org/) *(compiled)* * [Plates](http://platesphp.com/) *(native)* -* [Smarty](http://www.smarty.net/) *(compiled)* -* [Twig](http://twig.sensiolabs.org/) *(compiled)* -* [Zend\View](http://framework.zend.com/manual/2.3/en/modules/zend.view.quick-start.html) *(native, framework specific)* +* [Smarty](https://www.smarty.net/) *(compiled)* +* [Twig](https://twig.symfony.com/) *(compiled)* +* [Zend\View](https://framework.zend.com/manual/2.3/en/modules/zend.view.quick-start.html) *(native, framework specific)* From f8278e53572d1b23d4d92e2b54ac67e896bfb14d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:36:52 -0400 Subject: [PATCH 112/127] Update links in Errors section to use https --- _posts/09-02-01-Errors.md | 26 +++++++++++++------------- _posts/09-03-01-Exceptions.md | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/_posts/09-02-01-Errors.md b/_posts/09-02-01-Errors.md index c510a70..dd38fd9 100644 --- a/_posts/09-02-01-Errors.md +++ b/_posts/09-02-01-Errors.md @@ -1,5 +1,5 @@ ---- -isChild: true +--- +isChild: true anchor: errors --- @@ -104,7 +104,7 @@ with the following. xdebug.scream = On {% endhighlight %} -You can also set this value at runtime with the `ini_set` function +You can also set this value at runtime with the `ini_set` function {% highlight php %} Date: Tue, 19 Jun 2018 14:44:20 -0400 Subject: [PATCH 113/127] Update Security links with https --- _posts/10-02-01-Web-Application-Security.md | 2 +- _posts/10-03-01-Password-Hashing.md | 16 ++++++++-------- _posts/10-04-01-Data-Filtering.md | 14 +++++++------- _posts/10-06-01-Register-Globals.md | 2 +- _posts/10-07-01-Error-Reporting.md | 10 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/_posts/10-02-01-Web-Application-Security.md b/_posts/10-02-01-Web-Application-Security.md index 662b3c7..ee9c7fb 100644 --- a/_posts/10-02-01-Web-Application-Security.md +++ b/_posts/10-02-01-Web-Application-Security.md @@ -15,4 +15,4 @@ methods to protect yourself against them. This is a must read for the security-c [1]: https://www.owasp.org/ [2]: https://www.owasp.org/index.php/Guide_Table_of_Contents -[3]: http://phpsecurity.readthedocs.org/en/latest/index.html +[3]: https://phpsecurity.readthedocs.io/en/latest/index.html diff --git a/_posts/10-03-01-Password-Hashing.md b/_posts/10-03-01-Password-Hashing.md index 6893f9c..5b12ba7 100644 --- a/_posts/10-03-01-Password-Hashing.md +++ b/_posts/10-03-01-Password-Hashing.md @@ -12,13 +12,13 @@ It is important that you properly [_hash_][3] passwords before storing them. Pas 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. +unauthorized third-party, all user accounts are now compromised. Passwords should also be individually [_salted_][5] by adding a random string to each password before hashing. This prevents dictionary attacks and the use of "rainbow tables" (a reverse list of crytographic hashes for common passwords.) -Hashing and salting are vital as often users use the same password for multiple services and password quality can be poor. +Hashing and salting are vital as often users use the same password for multiple services and password quality can be poor. -Fortunately, nowadays PHP makes this easy. +Fortunately, nowadays PHP makes this easy. **Hashing passwords with `password_hash`** @@ -40,9 +40,9 @@ if (password_verify('bad-password', $passwordHash)) { } else { // Wrong password } -{% endhighlight %} +{% endhighlight %} -`password_hash()` takes care of password salting for you. The salt is stored, along with the algorithm and "cost", as part of the hash. `password_verify()` extracts this to determine how to check the password, so you don't need a separate database field to store your salts. +`password_hash()` takes care of password salting for you. The salt is stored, along with the algorithm and "cost", as part of the hash. `password_verify()` extracts this to determine how to check the password, so you don't need a separate database field to store your salts. * [Learn about `password_hash()`] [1] * [`password_compat` for PHP >= 5.3.7 && < 5.5] [2] @@ -51,8 +51,8 @@ if (password_verify('bad-password', $passwordHash)) { * [PHP `password_hash()` RFC] [4] -[1]: http://php.net/function.password-hash +[1]: https://secure.php.net/function.password-hash [2]: https://github.com/ircmaxell/password_compat -[3]: http://en.wikipedia.org/wiki/Cryptographic_hash_function +[3]: https://wikipedia.org/wiki/Cryptographic_hash_function [4]: https://wiki.php.net/rfc/password_hash -[5]: https://en.wikipedia.org/wiki/Salt_(cryptography) +[5]: https://wikipedia.org/wiki/Salt_(cryptography) diff --git a/_posts/10-04-01-Data-Filtering.md b/_posts/10-04-01-Data-Filtering.md index a1b3e17..3a5ba75 100644 --- a/_posts/10-04-01-Data-Filtering.md +++ b/_posts/10-04-01-Data-Filtering.md @@ -62,11 +62,11 @@ phone number, or age when processing a registration submission. [See Validation Filters][3] -[1]: http://php.net/book.filter -[2]: http://php.net/filter.filters.sanitize -[3]: http://php.net/filter.filters.validate -[4]: http://php.net/function.filter-var -[5]: http://php.net/function.filter-input -[6]: http://php.net/security.filesystem.nullbytes +[1]: https://secure.php.net/book.filter +[2]: https://secure.php.net/filter.filters.sanitize +[3]: https://secure.php.net/filter.filters.validate +[4]: https://secure.php.net/function.filter-var +[5]: https://secure.php.net/function.filter-input +[6]: https://secure.php.net/security.filesystem.nullbytes [html-purifier]: http://htmlpurifier.org/ -[unserialize]: https://secure.php.net/manual/en/function.unserialize.php +[unserialize]: https://secure.php.net/manual/function.unserialize.php diff --git a/_posts/10-06-01-Register-Globals.md b/_posts/10-06-01-Register-Globals.md index 79127d1..3b4183d 100644 --- a/_posts/10-06-01-Register-Globals.md +++ b/_posts/10-06-01-Register-Globals.md @@ -15,4 +15,4 @@ issues as your application cannot effectively tell where the data is coming from For example: `$_GET['foo']` would be available via `$foo`, which can override variables that have not been declared. If you are using PHP < 5.4.0 __make sure__ that `register_globals` is __off__. -* [Register_globals in the PHP manual](http://php.net/security.globals) +* [Register_globals in the PHP manual](https://secure.php.net/security.globals) diff --git a/_posts/10-07-01-Error-Reporting.md b/_posts/10-07-01-Error-Reporting.md index 809f018..77cf18f 100644 --- a/_posts/10-07-01-Error-Reporting.md +++ b/_posts/10-07-01-Error-Reporting.md @@ -23,7 +23,7 @@ log_errors = On > Passing in the value `-1` will show every possible error, even when new levels and constants are added in future PHP > versions. The `E_ALL` constant also behaves this way as of PHP 5.4. - -> [php.net](http://php.net/function.error-reporting) +> [php.net](https://secure.php.net/function.error-reporting) The `E_STRICT` error level constant was introduced in 5.3.0 and is not part of `E_ALL`, however it became part of `E_ALL` in 5.4.0. What does this mean? In terms of reporting every possible error in version 5.3 it means you must @@ -49,7 +49,7 @@ log_errors = On With these settings in production, errors will still be logged to the error logs for the web server, but will not be shown to the user. For more information on these settings, see the PHP manual: -* [error_reporting](http://php.net/errorfunc.configuration#ini.error-reporting) -* [display_errors](http://php.net/errorfunc.configuration#ini.display-errors) -* [display_startup_errors](http://php.net/errorfunc.configuration#ini.display-startup-errors) -* [log_errors](http://php.net/errorfunc.configuration#ini.log-errors) +* [error_reporting](https://secure.php.net/errorfunc.configuration#ini.error-reporting) +* [display_errors](https://secure.php.net/errorfunc.configuration#ini.display-errors) +* [display_startup_errors](https://secure.php.net/errorfunc.configuration#ini.display-startup-errors) +* [log_errors](https://secure.php.net/errorfunc.configuration#ini.log-errors) From 00416c4b114312d637ae53b691c71db67a85ddf5 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 14:49:42 -0400 Subject: [PATCH 114/127] Update Testing links with https --- _posts/11-02-01-Test-Driven-Development.md | 16 ++++++++-------- _posts/11-03-01-Behavior-Driven-Development.md | 8 ++++---- _posts/11-04-01-Complementary-Testing-Tools.md | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/_posts/11-02-01-Test-Driven-Development.md b/_posts/11-02-01-Test-Driven-Development.md index 9c319dd..745f7f1 100644 --- a/_posts/11-02-01-Test-Driven-Development.md +++ b/_posts/11-02-01-Test-Driven-Development.md @@ -5,7 +5,7 @@ anchor: test_driven_development ## Test Driven Development {#test_driven_development_title} -From [Wikipedia](http://en.wikipedia.org/wiki/Test-driven_development): +From [Wikipedia](https://wikipedia.org/wiki/Test-driven_development): > Test-driven development (TDD) is a software development process that relies on the repetition of a very short > development cycle: first the developer writes a failing automated test case that defines a desired improvement or new @@ -32,17 +32,17 @@ The other use for unit tests is contributing to open source. If you can write a (i.e. fails), then fix it, and show the test passing, patches are much more likely to be accepted. If you run a project which accepts pull requests then you should suggest this as a requirement. -[PHPUnit](http://phpunit.de) is the de-facto testing framework for writing unit tests for PHP applications, but there +[PHPUnit](https://phpunit.de/) is the de-facto testing framework for writing unit tests for PHP applications, but there are several alternatives * [atoum](https://github.com/atoum/atoum) * [Kahlan](https://github.com/crysalead/kahlan) -* [Peridot](http://peridot-php.github.io/) +* [Peridot](https://peridot-php.github.io/) * [SimpleTest](http://simpletest.org) ### Integration Testing -From [Wikipedia](http://en.wikipedia.org/wiki/Integration_testing): +From [Wikipedia](https://wikipedia.org/wiki/Integration_testing): > Integration testing (sometimes called Integration and Testing, abbreviated "I&T") is the phase in software testing in > which individual software modules are combined and tested as a group. It occurs after unit testing and before @@ -62,7 +62,7 @@ users of the application. #### Functional Testing Tools -* [Selenium](http://seleniumhq.com) -* [Mink](http://mink.behat.org) -* [Codeception](http://codeception.com) is a full-stack testing framework that includes acceptance testing tools -* [Storyplayer](http://datasift.github.io/storyplayer) is a full-stack testing framework that includes support for creating and destroying test environments on demand +* [Selenium](https://docs.seleniumhq.org/) +* [Mink](http://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 diff --git a/_posts/11-03-01-Behavior-Driven-Development.md b/_posts/11-03-01-Behavior-Driven-Development.md index 4585162..e952200 100644 --- a/_posts/11-03-01-Behavior-Driven-Development.md +++ b/_posts/11-03-01-Behavior-Driven-Development.md @@ -25,7 +25,7 @@ purpose. This framework is inspired by the [RSpec project][Rspec] for Ruby. [Behat]: http://behat.org/ -[Cucumber]: http://cukes.info/ -[PHPSpec]: http://www.phpspec.net/ -[RSpec]: http://rspec.info/ -[Codeception]: http://codeception.com/ +[Cucumber]: https://cucumber.io/ +[PHPSpec]: https://www.phpspec.net/ +[RSpec]: https://rspec.info/ +[Codeception]: https://codeception.com/ diff --git a/_posts/11-04-01-Complementary-Testing-Tools.md b/_posts/11-04-01-Complementary-Testing-Tools.md index e0af3a4..0f199ef 100644 --- a/_posts/11-04-01-Complementary-Testing-Tools.md +++ b/_posts/11-04-01-Complementary-Testing-Tools.md @@ -16,9 +16,9 @@ libraries useful for any preferred approach taken. [PHPSpec] and can be used with [PHPUnit]. -[Selenium]: http://seleniumhq.org/ +[Selenium]: https://www.seleniumhq.org/ [integrated with PHPUnit]: https://github.com/giorgiosironi/phpunit-selenium/ [Mockery]: https://github.com/padraic/mockery -[PHPUnit]: http://phpunit.de/ -[PHPSpec]: http://www.phpspec.net/ +[PHPUnit]: https://phpunit.de/ +[PHPSpec]: https://www.phpspec.net/ [Prophecy]: https://github.com/phpspec/prophecy From d6ebe39dff521cadbe1212485ea7f862648743c7 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:09:01 -0400 Subject: [PATCH 115/127] Update Servers links with https, remove broken links --- .../12-03-01-Virtual-or-Dedicated-Servers.md | 20 ++++++------ _posts/12-05-01-Building-your-Application.md | 31 +++++++++---------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md index 73e47e2..18ac985 100644 --- a/_posts/12-03-01-Virtual-or-Dedicated-Servers.md +++ b/_posts/12-03-01-Virtual-or-Dedicated-Servers.md @@ -21,7 +21,7 @@ especially important on virtual servers that don't have much memory to spare. ### Apache and PHP -PHP and Apache have a long history together. Apache is wildly configurable and has many available +PHP and Apache have a long history together. Apache is wildly configurable and has many available [modules][apache-modules] to extend functionality. It is a popular choice for shared servers and an easy setup for PHP frameworks and open source apps like WordPress. Unfortunately, Apache uses more resources than nginx by default and cannot handle as many visitors at the same time. @@ -45,16 +45,16 @@ If you are running Apache 2.4 or later, you can use [mod_proxy_fcgi] to get grea * [Read more on setting up Apache and PHP-FPM with mod_proxy_fcgi][tutorial-mod_proxy_fcgi] -[nginx]: http://nginx.org/ -[phpfpm]: http://php.net/install.fpm +[nginx]: https://nginx.org/ +[phpfpm]: https://secure.php.net/install.fpm [secure-nginx-phpfpm]: https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/ -[apache-modules]: http://httpd.apache.org/docs/2.4/mod/ -[prefork MPM]: http://httpd.apache.org/docs/2.4/mod/prefork.html -[worker MPM]: http://httpd.apache.org/docs/2.4/mod/worker.html -[event MPM]: http://httpd.apache.org/docs/2.4/mod/event.html -[apache]: http://httpd.apache.org/ -[apache-MPM]: http://httpd.apache.org/docs/2.4/mod/mpm_common.html +[apache-modules]: https://httpd.apache.org/docs/2.4/mod/ +[prefork MPM]: https://httpd.apache.org/docs/2.4/mod/prefork.html +[worker MPM]: https://httpd.apache.org/docs/2.4/mod/worker.html +[event MPM]: https://httpd.apache.org/docs/2.4/mod/event.html +[apache]: https://httpd.apache.org/ +[apache-MPM]: https://httpd.apache.org/docs/2.4/mod/mpm_common.html [mod_fastcgi]: https://blogs.oracle.com/opal/entry/php_fpm_fastcgi_process_manager -[mod_fcgid]: http://httpd.apache.org/mod_fcgid/ +[mod_fcgid]: hhttps://httpd.apache.org/mod_fcgid/ [mod_proxy_fcgi]: https://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html [tutorial-mod_proxy_fcgi]: https://serversforhackers.com/video/apache-and-php-fpm diff --git a/_posts/12-05-01-Building-your-Application.md b/_posts/12-05-01-Building-your-Application.md index b25e6fe..6b03906 100644 --- a/_posts/12-05-01-Building-your-Application.md +++ b/_posts/12-05-01-Building-your-Application.md @@ -28,7 +28,7 @@ There are many open source tools available to help you with build automation and [Phing] can control your packaging, deployment or testing process from within a XML build file. Phing (which is based on [Apache Ant]) provides a rich set of tasks usually needed to install or update a web application and can be extended with additional custom tasks, written in PHP. It's a solid and robust tool and has been around for a long time, however the tool could be perceived as a bit old fashioned because of the way it deals with configuration (XML files). -[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however you can successfully deploy PHP systems with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. Dave Gardner's blog post [PHP Deployment with Capistrano][phpdeploy_capistrano] is a good starting point for PHP developers interested in Capistrano. +[Capistrano] is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however you can successfully deploy PHP systems with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. [Rocketeer] gets its inspiration and philosophy from the Laravel framework. Its goal is to be fast, elegant and easy to use with smart defaults. It features multiple servers, multiple stages, atomic deploys and deployment can be performed in parallel. Everything in the tool can be hot swapped or extended, and everything is written in PHP. @@ -39,7 +39,6 @@ There are many open source tools available to help you with build automation and #### Further reading: * [Automate your project with Apache Ant][apache_ant_tutorial] -* [Expert PHP Deployments][expert_php_deployments] - free book on deployment with Capistrano, Phing and Vagrant. * [Deploying PHP Applications][deploying_php_applications] - paid book on best practices and tools for PHP deployment. ### Server Provisioning @@ -48,7 +47,7 @@ Managing and configuring servers can be a daunting task when faced with many ser [Ansible] is a tool that manages your infrastructure through YAML files. It's simple to get started with and can manage complex and large scale applications. There is an API for managing cloud instances and it can manage them through a dynamic inventory using certain tools. -[Puppet] is a tool that has its own language and file types for managing servers and configurations. It can be used in a master/client setup or it can be used in a "master-less" mode. In the master/client mode the clients will poll the central master(s) for new configuration on set intervals and update itself if necessary. In the master-less mode you can push changes to your nodes. +[Puppet] is a tool that has its own language and file types for managing servers and configurations. It can be used in a master/client setup or it can be used in a "master-less" mode. In the master/client mode the clients will poll the central master(s) for new configuration on set intervals and update itself if necessary. In the master-less mode you can push changes to your nodes. [Chef] is a powerful Ruby based system integration framework that you can build your whole server environment or virtual boxes with. It integrates well with Amazon Web Services through their service called OpsWorks. @@ -82,26 +81,24 @@ PHP. * [Continuous Integration with Teamcity][Teamcity] -[buildautomation]: http://en.wikipedia.org/wiki/Build_automation -[Phing]: http://www.phing.info/ -[Apache Ant]: http://ant.apache.org/ -[Capistrano]: https://github.com/capistrano/capistrano/wiki -[phpdeploy_capistrano]: http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/ -[phpdeploy_deployer]: http://www.sitepoint.com/deploying-php-applications-with-deployer/ +[buildautomation]: https://wikipedia.org/wiki/Build_automation +[Phing]: https://www.phing.info/ +[Apache Ant]: https://ant.apache.org/ +[Capistrano]: http://capistranorb.com/ +[phpdeploy_deployer]: https://www.sitepoint.com/deploying-php-applications-with-deployer/ [Chef]: https://www.chef.io/ [chef_vagrant_and_ec2]: http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/ [Chef_cookbook]: https://github.com/chef-cookbooks/php [Chef_tutorial]: https://www.youtube.com/playlist?list=PL11cZfNdwNyPnZA9D1MbVqldGuOWqbumZ -[apache_ant_tutorial]: http://net.tutsplus.com/tutorials/other/automate-your-projects-with-apache-ant/ +[apache_ant_tutorial]: https://code.tutsplus.com/tutorials/automate-your-projects-with-apache-ant--net-18595 [Travis CI]: https://travis-ci.org/ -[Jenkins]: http://jenkins-ci.org/ -[PHPCI]: http://www.phptesting.org/ -[Teamcity]: http://www.jetbrains.com/teamcity/ -[Deployer]: http://deployer.org/ +[Jenkins]: https://jenkins.io/ +[PHPCI]: https://www.phptesting.org/ +[Teamcity]: https://www.jetbrains.com/teamcity/ +[Deployer]: https://deployer.org/ [Rocketeer]: http://rocketeer.autopergamene.eu/ -[Magallanes]: http://magephp.com/ -[expert_php_deployments]: http://viccherubini.com/assets/Expert-PHP-Deployments.pdf -[deploying_php_applications]: http://www.deployingphpapplications.com +[Magallanes]: https://www.magephp.com/ +[deploying_php_applications]: https://deployingphpapplications.com/ [Ansible]: https://www.ansible.com/ [Puppet]: https://puppet.com/ [ansible_for_devops]: https://leanpub.com/ansible-for-devops From 9059a5fd29058163214ef01a108b5eef3d17db37 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:13:12 -0400 Subject: [PATCH 116/127] Update Vagrant and Docker links to use https --- _posts/13-02-01-Vagrant.md | 6 +++--- _posts/13-03-01-Docker.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_posts/13-02-01-Vagrant.md b/_posts/13-02-01-Vagrant.md index 5d69ecd..a37c2c9 100644 --- a/_posts/13-02-01-Vagrant.md +++ b/_posts/13-02-01-Vagrant.md @@ -28,10 +28,10 @@ document controls everything that is installed on the virtual machine. - [Phansible][Phansible]: provides an easy to use interface that helps you generate Ansible Playbooks for PHP based projects. -[Vagrant]: http://vagrantup.com/ -[Puppet]: http://www.puppetlabs.com/ +[Vagrant]: https://www.vagrantup.com/ +[Puppet]: https://puppet.com/ [Chef]: https://www.chef.io/ [Rove]: http://rove.io/ [Puphpet]: https://puphpet.com/ -[Protobox]: http://getprotobox.com/ +[Protobox]: https://www.getprotobox.com/ [Phansible]: http://phansible.com/ diff --git a/_posts/13-03-01-Docker.md b/_posts/13-03-01-Docker.md index 7292556..baf5881 100644 --- a/_posts/13-03-01-Docker.md +++ b/_posts/13-03-01-Docker.md @@ -11,7 +11,7 @@ A typical LAMP application might have three containers: a web server, a PHP-FPM You can generate containers from the command line (see example below) or, for ease of maintenance, build a `docker-compose.yml` file for your project specifying which to create and how they communicate with one another. -Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's own virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. +Docker may help if you're developing multiple websites and want the separation that comes from installing each on it's own virtual machine, but don't have the necessary disk space or the time to keep everything up to date. It's efficient: the installation and downloads are quicker, you only need to store one copy of each image however often it's used, containers need less RAM and share the same OS kernel, so you can have more servers running simultaneously, and it takes a matter of seconds to stop and start them, no need to wait for a full server boot. ### Example: Running your PHP Applications in Docker @@ -36,9 +36,9 @@ The [PHPDocker.io] site will auto-generate all the files you need for a fully-fe * [Docker Hub][docker-hub] * [Docker Hub - official images][docker-hub-official] -[Docker]: http://docker.com/ +[Docker]: https://www.docker.com/ [docker-hub]: https://hub.docker.com/ [docker-hub-official]: https://hub.docker.com/explore/ -[docker-install]: https://docs.docker.com/installation/ -[docker-doc]: https://docs.docker.com/userguide/ +[docker-install]: https://docs.docker.com/install/ +[docker-doc]: https://docs.docker.com/ [PHPDocker.io]: https://phpdocker.io/generator From 00cd8cf7f192df4bb3768498a6c7c3c8aa655d3e Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:16:24 -0400 Subject: [PATCH 117/127] Update caching links to use https --- _posts/14-02-01-Opcode-Cache.md | 14 +++++++------- _posts/14-03-01-Object-Caching.md | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_posts/14-02-01-Opcode-Cache.md b/_posts/14-02-01-Opcode-Cache.md index 0eb1d60..4b428f0 100644 --- a/_posts/14-02-01-Opcode-Cache.md +++ b/_posts/14-02-01-Opcode-Cache.md @@ -5,11 +5,11 @@ anchor: opcode_cache ## Opcode Cache {#opcode_cache_title} -When a PHP file is executed, it must first be compiled into [opcodes](http://php.net/manual/en/internals2.opcodes.php) (machine language instructions for the CPU). If the source code is unchanged, the opcodes will be the same, so this compilation step becomes a waste of CPU resources. +When a PHP file is executed, it must first be compiled into [opcodes](https://secure.php.net/manual/internals2.opcodes.php) (machine language instructions for the CPU). If the source code is unchanged, the opcodes will be the same, so this compilation step becomes a waste of CPU resources. An opcode cache prevents redundant compilation by storing opcodes in memory and reusing them on successive calls. It will typically check signature or modification time of the file first, in case there have been any changes. -It's likely an opcode cache will make a significant speed improvement to your application. Since PHP 5.5 there is one built in - [Zend OPcache][opcache-book]. Depending on your PHP package/distribution, it's usually turned on by default - check [opcache.enable](http://php.net/manual/en/opcache.configuration.php#ini.opcache.enable) and the output of `phpinfo()` to make sure. For earlier versions there's a PECL extension. +It's likely an opcode cache will make a significant speed improvement to your application. Since PHP 5.5 there is one built in - [Zend OPcache][opcache-book]. Depending on your PHP package/distribution, it's usually turned on by default - check [opcache.enable](https://secure.php.net/manual/opcache.configuration.php#ini.opcache.enable) and the output of `phpinfo()` to make sure. For earlier versions there's a PECL extension. Read more about opcode caches: @@ -21,9 +21,9 @@ Read more about opcode caches: * [list of PHP accelerators on Wikipedia][PHP_accelerators] -[opcache-book]: http://php.net/book.opcache -[APC]: http://php.net/book.apc -[XCache]: http://xcache.lighttpd.net/ +[opcache-book]: https://secure.php.net/book.opcache +[APC]: https://secure.php.net/book.apc +[XCache]: https://xcache.lighttpd.net/ [Zend Optimizer+]: https://github.com/zendtech/ZendOptimizerPlus -[WinCache]: http://www.iis.net/download/wincacheforphp -[PHP_accelerators]: http://en.wikipedia.org/wiki/List_of_PHP_accelerators +[WinCache]: https://www.iis.net/downloads/microsoft/wincache-extension +[PHP_accelerators]: https://wikipedia.org/wiki/List_of_PHP_accelerators diff --git a/_posts/14-03-01-Object-Caching.md b/_posts/14-03-01-Object-Caching.md index 7dc9a77..0763d7d 100644 --- a/_posts/14-03-01-Object-Caching.md +++ b/_posts/14-03-01-Object-Caching.md @@ -48,8 +48,8 @@ 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) -* [APC Functions](http://php.net/ref.apc) -* [Memcached](http://memcached.org/) -* [Redis](http://redis.io/) -* [XCache APIs](http://xcache.lighttpd.net/wiki/XcacheApi) -* [WinCache Functions](http://php.net/ref.wincache) +* [APC Functions](https://secure.php.net/ref.apc) +* [Memcached](https://memcached.org/) +* [Redis](https://redis.io/) +* [XCache APIs](https://xcache.lighttpd.net/wiki/XcacheApi) +* [WinCache Functions](https://secure.php.net/ref.wincache) From ef9985bd3f45b08db20bf94d607c9eca28897296 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:19:54 -0400 Subject: [PATCH 118/127] Update code documentation links to use https --- _posts/15-02-01-PHPDoc.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/_posts/15-02-01-PHPDoc.md b/_posts/15-02-01-PHPDoc.md index 37dedd3..cd46749 100644 --- a/_posts/15-02-01-PHPDoc.md +++ b/_posts/15-02-01-PHPDoc.md @@ -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]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/index.html -[PHPDoc manual]: http://www.phpdoc.org/docs/latest/index.html -[@author]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/author.html -[@link]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/link.html -[@param]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/param.html -[@return]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/return.html -[@throws]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/throws.html +[tags]: https://docs.phpdoc.org/references/phpdoc/tags/index.html +[PHPDoc manual]: https://docs.phpdoc.org/index.html +[@author]: https://docs.phpdoc.org/references/phpdoc/tags/author.html +[@link]: https://docs.phpdoc.org/references/phpdoc/tags/link.html +[@param]: https://docs.phpdoc.org/references/phpdoc/tags/param.html +[@return]: https://docs.phpdoc.org/references/phpdoc/tags/return.html +[@throws]: https://docs.phpdoc.org/references/phpdoc/tags/throws.html From a25b89660f6194b2aaa993ce228d0103a2b1433d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:44:18 -0400 Subject: [PATCH 119/127] Update links in Resources section to use https, remove bad links --- _posts/16-02-01-From-the-Source.md | 4 ++-- _posts/16-03-01-People-to-Follow.md | 11 +++-------- _posts/16-04-01-Mentoring.md | 2 +- _posts/16-05-01-PHP-PaaS-Providers.md | 20 ++++++++++---------- _posts/16-06-01-Frameworks.md | 6 ++---- _posts/16-07-01-Components.md | 7 +++---- _posts/16-08-01-Sites.md | 13 +++++++------ _posts/16-09-01-Videos.md | 8 ++++---- _posts/16-10-01-Books.md | 2 -- _posts/17-01-01-Community.md | 6 +++--- _posts/17-02-01-User-Groups.md | 9 ++++----- _posts/17-03-01-Conferences.md | 2 +- _posts/17-04-01-Elephpants.md | 4 ++-- 13 files changed, 42 insertions(+), 52 deletions(-) diff --git a/_posts/16-02-01-From-the-Source.md b/_posts/16-02-01-From-the-Source.md index 0a8d785..43474c4 100644 --- a/_posts/16-02-01-From-the-Source.md +++ b/_posts/16-02-01-From-the-Source.md @@ -6,5 +6,5 @@ anchor: from_the_source ## From the Source {#from_the_source_title} -* [PHP Website](http://php.net/) -* [PHP Documentation](http://php.net/docs.php) +* [PHP Website](https://secure.php.net/) +* [PHP Documentation](https://secure.php.net/docs.php) diff --git a/_posts/16-03-01-People-to-Follow.md b/_posts/16-03-01-People-to-Follow.md index 2ddf768..b96c6bf 100644 --- a/_posts/16-03-01-People-to-Follow.md +++ b/_posts/16-03-01-People-to-Follow.md @@ -8,12 +8,7 @@ anchor: people_to_follow It's difficult to find interesting and knowledgeable PHP community members when you are first starting out. You can -find a comprehensive list of PHP community members and their -Twitter handles at: +find an abbreviated list of PHP community members to get you started at: -* [New Relic: 25 PHP Developers to Follow Online][php-developers-to-follow] -* [OGProgrammer: How to get connected with the PHP community][og-twitter-list] - - -[php-developers-to-follow]: https://blog.newrelic.com/2014/05/02/25-php-developers-follow-online/ -[og-twitter-list]: https://www.ogprogrammer.com/2017/06/28/how-to-get-connected-with-the-php-community/ +* +* diff --git a/_posts/16-04-01-Mentoring.md b/_posts/16-04-01-Mentoring.md index 788553c..09172e6 100644 --- a/_posts/16-04-01-Mentoring.md +++ b/_posts/16-04-01-Mentoring.md @@ -5,4 +5,4 @@ anchor: mentoring ## Mentoring {#mentoring_title} -* [php-mentoring.org](http://php-mentoring.org/) - Formal, peer to peer mentoring in the PHP community. +* [php-mentoring.org](https://php-mentoring.org/) - Formal, peer to peer mentoring in the PHP community. diff --git a/_posts/16-05-01-PHP-PaaS-Providers.md b/_posts/16-05-01-PHP-PaaS-Providers.md index 58d28f3..5d934d4 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} -* [PagodaBox](https://pagodabox.io/) * [AppFog](https://www.ctl.io/appfog/) -* [Heroku](https://devcenter.heroku.com/categories/php) -* [fortrabbit](https://www.fortrabbit.com/) -* [Engine Yard Cloud](https://www.engineyard.com/features) -* [Red Hat OpenShift Platform](https://www.openshift.com/) * [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) -* [Windows Azure](http://www.windowsazure.com/) +* [Cloudways](https://www.cloudways.com/) +* [Engine Yard Cloud](https://www.engineyard.com/features) +* [fortrabbit](https://www.fortrabbit.com/) * [Google App Engine](https://cloud.google.com/appengine/docs/php/) -* [Jelastic](http://jelastic.com/) +* [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/) +* [Microsoft Azure](https://azure.microsoft.com/) +* [Nanobox](https://nanobox.io/) +* [Pivotal Web Services](https://run.pivotal.io/) * [Platform.sh](https://platform.sh/) -* [Cloudways](https://www.cloudways.com/en/) -* [IBM Bluemix Cloud Foundry](https://console.ng.bluemix.net/) -* [Pivotal Web Service Cloud Foundry](https://run.pivotal.io/) +* [Red Hat OpenShift](https://www.openshift.com/) To see which versions these PaaS hosts are running, head over to [PHP Versions](http://phpversions.info/paas-hosting/). diff --git a/_posts/16-06-01-Frameworks.md b/_posts/16-06-01-Frameworks.md index 63c27b2..b003a8c 100644 --- a/_posts/16-06-01-Frameworks.md +++ b/_posts/16-06-01-Frameworks.md @@ -19,10 +19,8 @@ Micro-frameworks are essentially a wrapper to route a HTTP request to a callback possible, and sometimes come with a few extra libraries to assist development such as basic database wrappers and the like. They are prominently used to build remote HTTP services. -Many frameworks add a considerable number of features on top of what is available in a micro-framework and these are -known Full-Stack Frameworks. These often come bundled with ORMs, Authentication packages, etc. +Many frameworks add a considerable number of features on top of what is available in a micro-framework; these are +called Full-Stack Frameworks. These often come bundled with ORMs, Authentication packages, etc. Component-based frameworks are collections of specialized and single-purpose libraries. Disparate component-based frameworks can be used together to make a micro- or full-stack framework. - -* [Popular PHP Frameworks](https://github.com/codeguy/php-the-right-way/wiki/Frameworks) \ No newline at end of file diff --git a/_posts/16-07-01-Components.md b/_posts/16-07-01-Components.md index c614d9b..3d9c700 100644 --- a/_posts/16-07-01-Components.md +++ b/_posts/16-07-01-Components.md @@ -38,12 +38,11 @@ components best decoupled from the Laravel framework are listed above._ [PEAR]: /#pear [Dependency Management]: /#dependency_management [FuelPHP Validation package]: https://github.com/fuelphp/validation -[Aura]: http://auraphp.com/framework/2.x/en/ +[Aura]: http://auraphp.com/framework/ [FuelPHP]: https://github.com/fuelphp [Hoa Project]: https://github.com/hoaproject -[Orno]: https://github.com/orno -[Symfony Components]: http://symfony.com/doc/current/components/index.html -[The League of Extraordinary Packages]: http://thephpleague.com/ +[Symfony Components]: https://symfony.com/doc/current/components/index.html +[The League of Extraordinary Packages]: https://thephpleague.com/ [IoC Container]: https://github.com/illuminate/container [Eloquent ORM]: https://github.com/illuminate/database [Queue]: https://github.com/illuminate/queue diff --git a/_posts/16-08-01-Sites.md b/_posts/16-08-01-Sites.md index b6e8403..3953aae 100644 --- a/_posts/16-08-01-Sites.md +++ b/_posts/16-08-01-Sites.md @@ -19,16 +19,17 @@ PHP versions * [Why You Should Be Using Supported PHP Versions](https://kinsta.com/blog/php-versions/) ### News around the PHP and web development communities + You can subscribe to weekly newsletters to keep yourself informed on new libraries, latest news, events and general announcements, as well as additional resources being published every now and then: * [PHP Weekly](http://www.phpweekly.com) -* [JavaScript Weekly](http://javascriptweekly.com) -* [HTML5 Weekly](http://html5weekly.com) -* [Mobile Web Weekly](http://mobilewebweekly.co) -* There are also Weeklies on other platforms you might be interested in; here's -[a list of some](https://github.com/jondot/awesome-weekly). +* [JavaScript Weekly](https://javascriptweekly.com/) +* [Frontend Focus](https://frontendfoc.us/) +* [Mobile Web Weekly](https://mobiledevweekly.com/) + +There are also Weeklies on other platforms you might be interested in; here's [a list of some](https://github.com/jondot/awesome-weekly). ### PHP universe -* [PHP Developer blog](http://blog.phpdeveloper.org/) +* [PHP Developer blog](https://blog.phpdeveloper.org/) diff --git a/_posts/16-09-01-Videos.md b/_posts/16-09-01-Videos.md index 7cdbd6f..a9d74c9 100644 --- a/_posts/16-09-01-Videos.md +++ b/_posts/16-09-01-Videos.md @@ -14,8 +14,8 @@ title: Video Tutorials ### Paid Videos -* [Standards and Best practices](http://teamtreehouse.com/library/standards-and-best-practices) -* [PHP Training on Pluralsight](http://www.pluralsight.com/search/?searchTerm=php) -* [PHP Training on Lynda.com](http://www.lynda.com/search?q=php) -* [PHP Training on Tutsplus](http://code.tutsplus.com/categories/php/courses) +* [Standards and Best practices](https://teamtreehouse.com/library/php-standards-and-best-practices) +* [PHP Training on Pluralsight](https://www.pluralsight.com/search?q=php) +* [PHP Training on Lynda.com](https://www.lynda.com/search?q=php) +* [PHP Training on Tutsplus](https://code.tutsplus.com/categories/php/courses) * [Laracasts](https://laracasts.com/) diff --git a/_posts/16-10-01-Books.md b/_posts/16-10-01-Books.md index 1620f2d..d798f4c 100644 --- a/_posts/16-10-01-Books.md +++ b/_posts/16-10-01-Books.md @@ -31,7 +31,5 @@ security terms and provides some examples of them in every day PHP * [Scaling PHP](http://www.scalingphpbook.com/) - Stop playing sysadmin and get back to coding * [Signaling PHP](https://leanpub.com/signalingphp) - PCNLT signals are a great help when writing PHP scripts that run from the command line. -* [The Grumpy Programmer's Guide To Building Testable PHP Applications](https://leanpub.com/grumpy-testing) - Learning -to write testable code doesn't have to suck. * [Minimum Viable Tests](https://leanpub.com/minimumviabletests) - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started. * [Domain-Driven Design in PHP](https://leanpub.com/ddd-in-php) - See real examples written in PHP showcasing Domain-Driven Design Architectural Styles (Hexagonal Architecture, CQRS or Event Sourcing), Tactical Design Patterns, and Bounded Context Integration. diff --git a/_posts/17-01-01-Community.md b/_posts/17-01-01-Community.md index 82be581..6731a72 100644 --- a/_posts/17-01-01-Community.md +++ b/_posts/17-01-01-Community.md @@ -14,8 +14,8 @@ friends! Other community resources include the Google+ PHP [Programmer community [Read the Official PHP Events Calendar][php-calendar] -[php-irc]: http://webchat.freenode.net/?channels=phpc +[php-irc]: https://webchat.freenode.net/?channels=phpc [phpc-twitter]: https://twitter.com/phpc [php-programmers-gplus]: https://plus.google.com/u/0/communities/104245651975268426012 -[php-so]: http://stackoverflow.com/questions/tagged/php -[php-calendar]: http://php.net/cal.php +[php-so]: https://stackoverflow.com/questions/tagged/php +[php-calendar]: https://secure.php.net/cal.php diff --git a/_posts/17-02-01-User-Groups.md b/_posts/17-02-01-User-Groups.md index 7fcd668..d60d259 100644 --- a/_posts/17-02-01-User-Groups.md +++ b/_posts/17-02-01-User-Groups.md @@ -6,9 +6,9 @@ anchor: user_groups ## PHP User Groups {#user_groups_title} 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 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! +[PHP.ug][php-ug]. Alternate sources might be [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 online user group meetings with presentations by some of the top speakers in the PHP community. @@ -20,8 +20,7 @@ generally promote the creating of a "female friendly" and professional atmospher [google]: https://www.google.com/search?q=php+user+group+near+me [meetup]: http://www.meetup.com/find/ -[php-ug]: http://php.ug/ +[php-ug]: https://php.ug/ [NomadPHP]: https://nomadphp.com/ [PHPWomen]: http://phpwomen.org/ [php-wiki]: https://wiki.php.net/usergroups -[php-uglist]: http://php.net/ug.php diff --git a/_posts/17-03-01-Conferences.md b/_posts/17-03-01-Conferences.md index 902f1ca..f2ef2af 100644 --- a/_posts/17-03-01-Conferences.md +++ b/_posts/17-03-01-Conferences.md @@ -12,4 +12,4 @@ industry leaders. [Find a PHP Conference][php-conf] -[php-conf]: http://php.net/conferences/index.php +[php-conf]: https://secure.php.net/conferences/index.php diff --git a/_posts/17-04-01-Elephpants.md b/_posts/17-04-01-Elephpants.md index c388833..ed2f0d1 100644 --- a/_posts/17-04-01-Elephpants.md +++ b/_posts/17-04-01-Elephpants.md @@ -10,6 +10,6 @@ anchor: elephpants [Interview with Vincent Pontier][vincent-pontier-interview] -[elephpant]: http://php.net/elephpant.php -[vincent-pontier-interview]: http://7php.com/elephpant/ +[elephpant]: https://secure.php.net/elephpant.php +[vincent-pontier-interview]: https://7php.com/elephpant/ [vincent-pontier]: http://www.elroubio.net/ From 97ce8a3a1ff6927bbad97eaf8beaef2827bbd988 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Tue, 19 Jun 2018 15:45:31 -0400 Subject: [PATCH 120/127] Remove Orno, its repo is empty --- _posts/16-07-01-Components.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_posts/16-07-01-Components.md b/_posts/16-07-01-Components.md index 3d9c700..3312fcc 100644 --- a/_posts/16-07-01-Components.md +++ b/_posts/16-07-01-Components.md @@ -22,7 +22,6 @@ For example, you can use the [FuelPHP Validation package], without needing to us * [Aura] * [FuelPHP] * [Hoa Project] -* [Orno] * [Symfony Components] * [The League of Extraordinary Packages] * Laravel's Illuminate Components From 8f4c727bee7912b1cc0fac1c8fb44e301907b598 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Wed, 20 Jun 2018 07:55:12 -0400 Subject: [PATCH 121/127] Remove banner image text --- _includes/welcome.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index ed56190..d08b66b 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -51,13 +51,5 @@ The most recent version of _PHP: The Right Way_ is also available in PDF, EPUB a Help make this website the best resource for new PHP programmers! [Contribute on GitHub][2] -## Spread the Word! - -_PHP: The Right Way_ has web banner images you can use on your website. Show your support, and let new PHP developers -know where to find good information! - -[See Banner Images][3] - [1]: https://leanpub.com/phptherightway [2]: https://github.com/codeguy/php-the-right-way/tree/gh-pages -[3]: /banners.html From 6fd96280f05f6d76df0c56876097786ec7ba1121 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Wed, 20 Jun 2018 08:01:34 -0400 Subject: [PATCH 122/127] Update template wrapper links, remove GA tracking --- _layouts/default.html | 26 ++++++++------------------ _layouts/page.html | 26 ++++++++------------------ 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index eace5e4..76fa1db 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,12 +5,12 @@ {% if page.title %}{{ page.title }} - {% endif %}PHP: The Right Way - + - + @@ -25,7 +25,7 @@

    PHP The Right Way

    Last Updated: {{ site.time }}
    @@ -72,27 +72,17 @@ - diff --git a/_layouts/page.html b/_layouts/page.html index 97f3162..a20d46c 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -5,12 +5,12 @@ {% if page.title %}{{ page.title }} - {% endif %}PHP: The Right Way - + - + @@ -25,7 +25,7 @@

    PHP The Right Way

    Last Updated: {{ site.time }}
    @@ -37,27 +37,17 @@ - From 7ff86c5eb9166c522d0ee25749d2cf9f98dc4aa1 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Wed, 20 Jun 2018 08:14:03 -0400 Subject: [PATCH 123/127] Add link to Clean Code PHP in Code Style sectionm --- _posts/02-01-01-Code-Style-Guide.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 2497cb7..f2c672c 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -55,6 +55,7 @@ It will show which kind of errors the code structure had before it fixed them. English is preferred for all symbol names and code infrastructure. Comments may be written in any language easily readable by all current and future parties who may be working on the codebase. +Finally, a good supplementary resource for writing clean PHP code is [Clean Code PHP][cleancode]. [fig]: https://www.php-fig.org/ [psr1]: https://www.php-fig.org/psr/psr-1/ @@ -66,3 +67,4 @@ readable by all current and future parties who may be working on the codebase. [phpcbf]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: https://cs.sensiolabs.org/ +[cleancode]: https://github.com/jupeter/clean-code-php From c9e5c2659e820d92d654b257fb8fe6c33ad7fc54 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Wed, 20 Jun 2018 08:33:44 -0400 Subject: [PATCH 124/127] Remove outdated Google Pagespeed link in UTF8 section --- _posts/05-05-01-PHP-and-UTF8.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/_posts/05-05-01-PHP-and-UTF8.md b/_posts/05-05-01-PHP-and-UTF8.md index c2d4af9..00fdc05 100644 --- a/_posts/05-05-01-PHP-and-UTF8.md +++ b/_posts/05-05-01-PHP-and-UTF8.md @@ -63,10 +63,14 @@ Further Reading for why. Use the `mb_http_output()` function to ensure that your PHP script outputs UTF-8 strings to your browser. -The browser will then need to be told by the HTTP response that this page should be considered as UTF-8. The historic -approach to doing that was to include the [charset `` tag](http://htmlpurifier.org/docs/enduser-utf8.html) in -your page's `` tag. This approach is perfectly valid, but setting the charset in the `Content-Type` header is -actually [much faster](https://developers.google.com/speed/docs/best-practices/rendering#SpecifyCharsetEarly). +The browser will then need to be told by the HTTP response that this page should be considered as UTF-8. Today, it is common to set the character set in the HTTP response header like this: + +{% highlight php %} +` tag](http://htmlpurifier.org/docs/enduser-utf8.html) in your page's `` tag. {% highlight php %} Date: Wed, 20 Jun 2018 08:41:39 -0400 Subject: [PATCH 125/127] Optimize database interaction code example --- _posts/07-04-01-Interacting-via-Code.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index a5e3b77..25fe068 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -33,7 +33,8 @@ function getAllFoos($db) { return $db->query('SELECT * FROM table'); } -foreach (getAllFoos($db) as $row) { +$results = getAllFoos($db); +foreach ($resultss as $row) { echo "
  • ".$row['field1']." - ".$row['field1']."
  • "; // BAD!! } {% endhighlight %} From b4e964f178a3e1d97a79f33deac8616473c4cb89 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Wed, 20 Jun 2018 10:27:53 -0400 Subject: [PATCH 126/127] Supersedes #725 --- _posts/10-02-01-Web-Application-Security.md | 25 +++++++++++++++++++ _posts/10-03-01-Password-Hashing.md | 27 +++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/_posts/10-02-01-Web-Application-Security.md b/_posts/10-02-01-Web-Application-Security.md index ee9c7fb..bbb4b90 100644 --- a/_posts/10-02-01-Web-Application-Security.md +++ b/_posts/10-02-01-Web-Application-Security.md @@ -5,6 +5,25 @@ anchor: web_application_security ## Web Application Security {#web_application_security_title} +It is very important for every PHP developer to learn [the basics of web application security][4], which can be broken +down into a handful of broad topics: + +1. Code-data separation. + * When data is executed as code, you get SQL Injection, Cross-Site Scripting, Local/Remote File Inclusion, etc. + * When code is printed as data, you get information leaks (source code disclosure or, in the case of C programs, + enough information to bypass [ASLR][5]). +2. Application logic. + * Missing authentication or authorization controls. + * Input validation. +3. Operating environment. + * PHP versions. + * Third party libraries. + * The operating system. +4. Cryptography weaknesses. + * [Weak random numbers][6]. + * [Chosen-ciphertext attacks][7]. + * [Side-channel information leaks][8]. + There are bad people ready and willing to exploit your web application. It is important that you take necessary precautions to harden your web application's security. Luckily, the fine folks at [The Open Web Application Security Project][1] (OWASP) have compiled a comprehensive list of known security issues and @@ -16,3 +35,9 @@ methods to protect yourself against them. This is a must read for the security-c [1]: https://www.owasp.org/ [2]: https://www.owasp.org/index.php/Guide_Table_of_Contents [3]: https://phpsecurity.readthedocs.io/en/latest/index.html +[4]: https://paragonie.com/blog/2015/08/gentle-introduction-application-security +[5]: http://searchsecurity.techtarget.com/definition/address-space-layout-randomization-ASLR +[6]: https://paragonie.com/blog/2016/01/on-design-and-implementation-stealth-backdoor-for-web-applications +[7]: https://paragonie.com/blog/2015/05/using-encryption-and-authentication-correctly +[8]: http://blog.ircmaxell.com/2014/11/its-all-about-time.html + diff --git a/_posts/10-03-01-Password-Hashing.md b/_posts/10-03-01-Password-Hashing.md index 5b12ba7..dc4448d 100644 --- a/_posts/10-03-01-Password-Hashing.md +++ b/_posts/10-03-01-Password-Hashing.md @@ -8,16 +8,30 @@ 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 -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. +It is important that you properly [_hash_][3] passwords before storing them. Hashing and encrypting are [two very different things][7] +that often get confused. + +Hashing is an irreversible, one-way function. 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. + +Unlike hashing, encryption is reversible (provided you have the key). Encryption is useful in other areas, but is a poor +strategy for securely storing passwords. Passwords should also be individually [_salted_][5] by adding a random string to each password before hashing. This prevents dictionary attacks and the use of "rainbow tables" (a reverse list of crytographic hashes for common passwords.) Hashing and salting are vital as often users use the same password for multiple services and password quality can be poor. +Additionally, you should use [a specialized _password hashing_ algoithm][6] rather than fast, general-purpose +cryptographic hash function (e.g. SHA256). The short list of acceptable password hashing algorithms (as of June 2018) +to use are: + +* Argon2 (available in PHP 7.2 and newer) +* Scrypt +* **Bcrypt** (PHP provides this one for you; see below) +* PBKDF2 with HMAC-SHA256 or HMAC-SHA512 + Fortunately, nowadays PHP makes this easy. **Hashing passwords with `password_hash`** @@ -56,3 +70,6 @@ if (password_verify('bad-password', $passwordHash)) { [3]: https://wikipedia.org/wiki/Cryptographic_hash_function [4]: https://wiki.php.net/rfc/password_hash [5]: https://wikipedia.org/wiki/Salt_(cryptography) +[6]: https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016 +[7]: https://paragonie.com/blog/2015/08/you-wouldnt-base64-a-password-cryptography-decoded + From 933b79a7dd10a49f469b0e73b21a30b157b0a7cc Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Wed, 20 Jun 2018 10:34:18 -0400 Subject: [PATCH 127/127] Fix code typo --- _posts/07-04-01-Interacting-via-Code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/07-04-01-Interacting-via-Code.md b/_posts/07-04-01-Interacting-via-Code.md index 25fe068..c335391 100644 --- a/_posts/07-04-01-Interacting-via-Code.md +++ b/_posts/07-04-01-Interacting-via-Code.md @@ -34,7 +34,7 @@ function getAllFoos($db) { } $results = getAllFoos($db); -foreach ($resultss as $row) { +foreach ($results as $row) { echo "
  • ".$row['field1']." - ".$row['field1']."
  • "; // BAD!! } {% endhighlight %}