From 0927cf99cf10cebb97be18fe5899bade14024903 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 24 Aug 2013 03:56:41 +0200 Subject: [PATCH 01/60] PHP.ug added to PHP User Groups information --- _posts/13-01-01-Community.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_posts/13-01-01-Community.md b/_posts/13-01-01-Community.md index 4af1185..709d1a8 100644 --- a/_posts/13-01-01-Community.md +++ b/_posts/13-01-01-Community.md @@ -6,7 +6,7 @@ The PHP community is as diverse as it is large, and its members are ready and wi ## PHP User Groups -If you live in a larger city, odds are there's a PHP user group nearby. Although there's not yet an official list of PUGs, you can easily find your local PUG by searching on [Google][google] or [Meetup.com][meetup]. If you live in a smaller town, there may not be a local PUG; if that's the case, start one! +If you live in a larger city, odds are there's a PHP user group nearby. Although there's not yet an official list of PUGs, you can easily find your local PUG by searching on [Google][google], [Meetup.com][meetup] or [PHP.ug][php-ug]. If you live in a smaller town, there may not be a local PUG; if that's the case, start one! [Read about User Groups on the PHP Wiki][php-wiki] @@ -19,6 +19,7 @@ The PHP community also hosts larger regional and national conferences in many co [php-calendar]: http://www.php.net/cal.php [google]: https://www.google.com/search?q=php+user+group+near+me [meetup]: http://www.meetup.com/find/ +[php-ug]: http://php.ug [php-wiki]: https://wiki.php.net/usergroups [php-conf]: http://php.net/conferences/index.php [phpc-twitter]: https://twitter.com/phpc From 670d1b903a951511cf462ede5a80f1ab21b0c1d1 Mon Sep 17 00:00:00 2001 From: Stuart Herbert Date: Wed, 28 Aug 2013 09:49:53 +0100 Subject: [PATCH 02/60] Update 09-02-01-Test-Driven-Development.md Added link to Storyplayer, one of the functional test tools available to the community. --- _posts/09-02-01-Test-Driven-Development.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/09-02-01-Test-Driven-Development.md b/_posts/09-02-01-Test-Driven-Development.md index 91a7e59..f6571d4 100644 --- a/_posts/09-02-01-Test-Driven-Development.md +++ b/_posts/09-02-01-Test-Driven-Development.md @@ -56,3 +56,4 @@ data and simulating actual users of the application. * [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 From e050ed5353987df0f892ed05b8aabd988616a679 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 12 Sep 2013 06:44:17 +0200 Subject: [PATCH 03/60] typos in behavior driven development --- _posts/09-03-01-Behavior-Driven-Development.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/09-03-01-Behavior-Driven-Development.md b/_posts/09-03-01-Behavior-Driven-Development.md index 9fa148c..d0cde20 100644 --- a/_posts/09-03-01-Behavior-Driven-Development.md +++ b/_posts/09-03-01-Behavior-Driven-Development.md @@ -4,9 +4,9 @@ isChild: true ## Behavior Driven Development {#behavior_driven_development_title} -There are two different types of Behavior-Driven Development (BDD): SpecBDD and StoryBDD. SpecBDD focuses on technical behavior or code, while StoryBDD focuses on business or feature behaviors or interactions. PHP has frameworks for both types of BDD. +There are two different types of Behavior-Driven Development (BDD): SpecBDD and StoryBDD. SpecBDD focuses on technical behavior of code, while StoryBDD focuses on business or feature behaviors or interactions. PHP has frameworks for both types of BDD. -With StoryBDD, you write human-readable stories that describe the behavior of your application. These stories +With StoryBDD, you write human-readable stories that describe the behavior of your application. These stories can then be run as actual tests against your application. The framework used in PHP applications for StoryBDD is Behat, which is inspired by Ruby's [Cucumber](http://cukes.info/) project and implements the Gherkin DSL for describing feature behavior. @@ -15,7 +15,7 @@ With SpecBDD, you write specifications that describe how your actual code should a function or method, you are describing how that function or method should behave. PHP offers the PHPSpec framework for this purpose. This framework is inspired by the [RSpec project](http://rspec.info/) for Ruby. -### BDD Links +### BDD Links * [Behat](http://behat.org/), the StoryBDD framework for PHP, inspired by Ruby's [Cucumber](http://cukes.info/) project; * [PHPSpec](http://www.phpspec.net/), the SpecBDD framework for PHP, inspired by Ruby's [RSpec](http://rspec.info/) project; From 94701e6ddb9a667200d194b28744d72e7ee59d0c Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 12 Sep 2013 11:15:12 +0200 Subject: [PATCH 04/60] irc channel added to url of webchat.freenode.net --- _posts/13-01-01-Community.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-01-01-Community.md b/_posts/13-01-01-Community.md index 4af1185..c0f985e 100644 --- a/_posts/13-01-01-Community.md +++ b/_posts/13-01-01-Community.md @@ -23,5 +23,5 @@ The PHP community also hosts larger regional and national conferences in many co [php-conf]: http://php.net/conferences/index.php [phpc-twitter]: https://twitter.com/phpc [php-programmers-gplus]: https://plus.google.com/u/0/communities/104245651975268426012 -[php-irc]: http://webchat.freenode.net/ +[php-irc]: http://webchat.freenode.net/?channels=phpc [php-so]: http://stackoverflow.com/questions/tagged/php From 1a935e0872d8ff1fc9b419f2a87aca5eaab21a35 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 12 Sep 2013 11:16:51 +0200 Subject: [PATCH 05/60] psr-3 link mark removed from coding style post since it is not used --- _posts/02-01-01-Code-Style-Guide.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index 3cd3fbb..e9d4657 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -33,7 +33,6 @@ by all current and future parties who may be working on the codebase. [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 -[psr3]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md [pear-cs]: http://pear.php.net/manual/en/standards.php [zend-cs]: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ From cf4f77ecaeb5b530c6c4a7e7d8f0878046e91312 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 12 Sep 2013 11:34:28 +0200 Subject: [PATCH 06/60] XDebug title added --- _posts/03-06-01-XDebug.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/03-06-01-XDebug.md b/_posts/03-06-01-XDebug.md index be511f3..402eb1e 100644 --- a/_posts/03-06-01-XDebug.md +++ b/_posts/03-06-01-XDebug.md @@ -1,4 +1,5 @@ --- +title: XDebug isChild: true --- From 1216c2e7daa3136529c8e5c97a0141bb87657c8f Mon Sep 17 00:00:00 2001 From: Mathieu Rochette Date: Fri, 13 Sep 2013 19:45:23 +0200 Subject: [PATCH 07/60] Hightlight web banners exemple code as HTML --- banners.md | 64 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/banners.md b/banners.md index 20ead19..b4a06bb 100644 --- a/banners.md +++ b/banners.md @@ -12,62 +12,78 @@ Spread the word with _PHP: The Right Way_ banner images! Show new PHP developers

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Button 2 (120x60)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Leaderboard (728x90)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Large Rectangle (386x280)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Medium Rectangle (300x250)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Rectangle (180x150)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Square Button (125x125)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} ## Vertical Rectangle (240x400)

PHP: The Right Way

- - PHP: The Right Way - +{% highlight html %} + + PHP: The Right Way + +{% endhighlight %} From 59d2ab2ce7ffc5fdad3164ff46cc209fde0026f4 Mon Sep 17 00:00:00 2001 From: Mathieu Rochette Date: Sat, 21 Sep 2013 19:53:41 +0200 Subject: [PATCH 08/60] fix vertical scrollbar --- _posts/08-03-01-Password-Hashing.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_posts/08-03-01-Password-Hashing.md b/_posts/08-03-01-Password-Hashing.md index 0bc6bc5..cf9f544 100644 --- a/_posts/08-03-01-Password-Hashing.md +++ b/_posts/08-03-01-Password-Hashing.md @@ -14,8 +14,9 @@ In PHP 5.5 `password_hash` was introduced. At this time it is using BCrypt, the Below we hash a string, and then check the hash against a new string. Because our two source strings are different ('secret-password' vs. 'bad-password') this login will fail. -{% highlight php %} - Date: Wed, 2 Oct 2013 15:39:27 +0100 Subject: [PATCH 09/60] Update 07-03-01-Exceptions.md Change misleading comment. --- _posts/07-03-01-Exceptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/07-03-01-Exceptions.md b/_posts/07-03-01-Exceptions.md index f5d68c3..13b3a8d 100644 --- a/_posts/07-03-01-Exceptions.md +++ b/_posts/07-03-01-Exceptions.md @@ -40,7 +40,7 @@ catch(Fuel\Email\SendingFailedException $e) } finally { - // Use this to let user know email was sent + // Executed regardless of whether an exception has been thrown, and before normal execution resumes } {% endhighlight %} From 44ed5460dcefe5f1f7dd69dbd14ba2efcd555131 Mon Sep 17 00:00:00 2001 From: kenden Date: Tue, 8 Oct 2013 13:47:59 +0200 Subject: [PATCH 10/60] Update 09-04-01-Complementary-Testing-Tools.md Updating link to the PHPUnit-Selenium integration page to the current version of PHPUnit --- _posts/09-04-01-Complementary-Testing-Tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/09-04-01-Complementary-Testing-Tools.md b/_posts/09-04-01-Complementary-Testing-Tools.md index 034937a..1cbc304 100644 --- a/_posts/09-04-01-Complementary-Testing-Tools.md +++ b/_posts/09-04-01-Complementary-Testing-Tools.md @@ -8,6 +8,6 @@ Besides individual testing and behavior driven frameworks, there are also a numb ### Tool Links -* [Selenium](http://seleniumhq.org/) is a browser automation tool which can be [integrated with PHPUnit](http://www.phpunit.de/manual/3.1/en/selenium.html) +* [Selenium](http://seleniumhq.org/) is a browser automation tool which can be [integrated with PHPUnit](http://phpunit.de/manual/current/en/selenium.html) * [Mockery](https://github.com/padraic/mockery) is a Mock Object Framework which can be integrated with [PHPUnit](http://phpunit.de/) or [PHPSpec](http://www.phpspec.net/) * [Prophecy](https://github.com/phpspec/prophecy) is a highly opinionated yet very powerful and flexible PHP object mocking framework. It's integrated with [PHPSpec](http://www.phpspec.net/) and can be used with [PHPUnit](http://phpunit.de/). From 737c15f18e628c816fe12a6e9588dab306cddf9f Mon Sep 17 00:00:00 2001 From: Jacek Kobus Date: Tue, 8 Oct 2013 22:27:05 +0200 Subject: [PATCH 11/60] added link to symfony coding standards --- _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 e9d4657..f7a6d0c 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -19,6 +19,7 @@ and applications that implement the components can have consistency even when wo * [Read about PSR-2][psr2] * [Read about PEAR Coding Standards][pear-cs] * [Read about Zend Coding Standards][zend-cs] +* [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. @@ -35,6 +36,7 @@ by all current and future parties who may be working on the codebase. [psr2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [pear-cs]: http://pear.php.net/manual/en/standards.php [zend-cs]: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards +[symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ From d02c7d66e827e9fdaa98be0a0d6d6648733d40e3 Mon Sep 17 00:00:00 2001 From: Matthew Malinowski Date: Wed, 6 Nov 2013 10:03:23 -0500 Subject: [PATCH 12/60] Add Mavericks PHP version to Mac Setup. --- _posts/01-04-01-Mac-Setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index c394dea..aa2fa29 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -4,8 +4,8 @@ isChild: true ## Mac Setup {#mac_setup_title} -OSX comes prepackaged with PHP but it is normally a little behind the latest stable. Lion comes with PHP 5.3.6 and -Mountain Lion has 5.3.10. +OSX comes prepackaged with PHP but it is normally a little behind the latest stable. Lion comes with PHP 5.3.6, +Mountain Lion has 5.3.10, and Mavericks has 5.4.17. To update PHP on OSX you can get it installed through a number of Mac [package managers][mac-package-managers], with [php-osx by Liip][php-osx-downloads] being recommended. From 7136211fd0ad2d224192b17343cd26a55997cc36 Mon Sep 17 00:00:00 2001 From: Alastair Hole Date: Wed, 20 Nov 2013 16:29:44 +0000 Subject: [PATCH 13/60] Update 03-06-01-XDebug.md Corrected MacGBDp to MacGDBp --- _posts/03-06-01-XDebug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/03-06-01-XDebug.md b/_posts/03-06-01-XDebug.md index 402eb1e..8334b5c 100644 --- a/_posts/03-06-01-XDebug.md +++ b/_posts/03-06-01-XDebug.md @@ -31,7 +31,7 @@ Your IDE will now intercept the current state as the script executes, allowing y values in memory. Graphical debuggers make it very easy to step through code, inspect variables, and eval code against the live runtime. -Many IDE's have built-in or plugin-based support for graphical debugging with xdebug. MacGBDp is a free, open-source, +Many IDE's have built-in or plugin-based support for graphical debugging with xdebug. MacGDBp is a free, open-source, stand-alone xdebug GUI for Mac. * [Learn more about XDebug][xdebug-docs] From c5ebc871dc801f4acb171a2f677e86d470d5f551 Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Tue, 26 Nov 2013 14:35:06 +0000 Subject: [PATCH 14/60] Renamed posts to allow Dependency Injection to be added --- _posts/{06-01-01-Databases.md => 08-01-01-Databases.md} | 0 _posts/{07-02-01-Errors.md => 08-02-01-Errors.md} | 0 _posts/{07-03-01-Exceptions.md => 08-03-01-Exceptions.md} | 0 _posts/{08-01-01-Security.md => 09-01-01-Security.md} | 0 ...plication-Security.md => 09-02-01-Web-Application-Security.md} | 0 ...{08-03-01-Password-Hashing.md => 09-03-01-Password-Hashing.md} | 0 _posts/{08-04-01-Data-Filtering.md => 09-04-01-Data-Filtering.md} | 0 ...-01-Configuration-Files.md => 09-05-01-Configuration-Files.md} | 0 ...{08-06-01-Register-Globals.md => 09-06-01-Register-Globals.md} | 0 .../{08-07-01-Error-Reporting.md => 09-07-01-Error-Reporting.md} | 0 _posts/{09-01-01-Testing.md => 10-01-01-Testing.md} | 0 ...-Driven-Development.md => 10-02-01-Test-Driven-Development.md} | 0 ...ven-Development.md => 10-03-01-Behavior-Driven-Development.md} | 0 ...y-Testing-Tools.md => 10-04-01-Complementary-Testing-Tools.md} | 0 ...rvers-and-Deployment.md => 11-01-01-Servers-and-Deployment.md} | 0 ...Platform-as-a-Service.md => 11-02-01-Platform-as-a-Service.md} | 0 ...icated-Servers.md => 11-03-01-Virtual-or-Dedicated-Servers.md} | 0 _posts/{10-04-01-Shared-Servers.md => 11-04-01-Shared-Servers.md} | 0 ...-your-Application.md => 11-05-01-Building-your-Application.md} | 0 _posts/{11-01-01-Caching.md => 12-01-01-Caching.md} | 0 _posts/{11-02-01-Bytecode-Cache.md => 12-02-01-Bytecode-Cache.md} | 0 _posts/{11-03-01-Object-Caching.md => 12-03-01-Object-Caching.md} | 0 _posts/{12-01-01-Resources.md => 13-01-01-Resources.md} | 0 _posts/{12-02-01-Frameworks.md => 13-02-01-Frameworks.md} | 0 _posts/{12-03-01-Components.md => 13-03-01-Components.md} | 0 _posts/{13-01-01-Community.md => 14-01-01-Community.md} | 0 26 files changed, 0 insertions(+), 0 deletions(-) rename _posts/{06-01-01-Databases.md => 08-01-01-Databases.md} (100%) rename _posts/{07-02-01-Errors.md => 08-02-01-Errors.md} (100%) rename _posts/{07-03-01-Exceptions.md => 08-03-01-Exceptions.md} (100%) rename _posts/{08-01-01-Security.md => 09-01-01-Security.md} (100%) rename _posts/{08-02-01-Web-Application-Security.md => 09-02-01-Web-Application-Security.md} (100%) rename _posts/{08-03-01-Password-Hashing.md => 09-03-01-Password-Hashing.md} (100%) rename _posts/{08-04-01-Data-Filtering.md => 09-04-01-Data-Filtering.md} (100%) rename _posts/{08-05-01-Configuration-Files.md => 09-05-01-Configuration-Files.md} (100%) rename _posts/{08-06-01-Register-Globals.md => 09-06-01-Register-Globals.md} (100%) rename _posts/{08-07-01-Error-Reporting.md => 09-07-01-Error-Reporting.md} (100%) rename _posts/{09-01-01-Testing.md => 10-01-01-Testing.md} (100%) rename _posts/{09-02-01-Test-Driven-Development.md => 10-02-01-Test-Driven-Development.md} (100%) rename _posts/{09-03-01-Behavior-Driven-Development.md => 10-03-01-Behavior-Driven-Development.md} (100%) rename _posts/{09-04-01-Complementary-Testing-Tools.md => 10-04-01-Complementary-Testing-Tools.md} (100%) rename _posts/{10-01-01-Servers-and-Deployment.md => 11-01-01-Servers-and-Deployment.md} (100%) rename _posts/{10-02-01-Platform-as-a-Service.md => 11-02-01-Platform-as-a-Service.md} (100%) rename _posts/{10-03-01-Virtual-or-Dedicated-Servers.md => 11-03-01-Virtual-or-Dedicated-Servers.md} (100%) rename _posts/{10-04-01-Shared-Servers.md => 11-04-01-Shared-Servers.md} (100%) rename _posts/{10-05-01-Building-your-Application.md => 11-05-01-Building-your-Application.md} (100%) rename _posts/{11-01-01-Caching.md => 12-01-01-Caching.md} (100%) rename _posts/{11-02-01-Bytecode-Cache.md => 12-02-01-Bytecode-Cache.md} (100%) rename _posts/{11-03-01-Object-Caching.md => 12-03-01-Object-Caching.md} (100%) rename _posts/{12-01-01-Resources.md => 13-01-01-Resources.md} (100%) rename _posts/{12-02-01-Frameworks.md => 13-02-01-Frameworks.md} (100%) rename _posts/{12-03-01-Components.md => 13-03-01-Components.md} (100%) rename _posts/{13-01-01-Community.md => 14-01-01-Community.md} (100%) diff --git a/_posts/06-01-01-Databases.md b/_posts/08-01-01-Databases.md similarity index 100% rename from _posts/06-01-01-Databases.md rename to _posts/08-01-01-Databases.md diff --git a/_posts/07-02-01-Errors.md b/_posts/08-02-01-Errors.md similarity index 100% rename from _posts/07-02-01-Errors.md rename to _posts/08-02-01-Errors.md diff --git a/_posts/07-03-01-Exceptions.md b/_posts/08-03-01-Exceptions.md similarity index 100% rename from _posts/07-03-01-Exceptions.md rename to _posts/08-03-01-Exceptions.md diff --git a/_posts/08-01-01-Security.md b/_posts/09-01-01-Security.md similarity index 100% rename from _posts/08-01-01-Security.md rename to _posts/09-01-01-Security.md diff --git a/_posts/08-02-01-Web-Application-Security.md b/_posts/09-02-01-Web-Application-Security.md similarity index 100% rename from _posts/08-02-01-Web-Application-Security.md rename to _posts/09-02-01-Web-Application-Security.md diff --git a/_posts/08-03-01-Password-Hashing.md b/_posts/09-03-01-Password-Hashing.md similarity index 100% rename from _posts/08-03-01-Password-Hashing.md rename to _posts/09-03-01-Password-Hashing.md diff --git a/_posts/08-04-01-Data-Filtering.md b/_posts/09-04-01-Data-Filtering.md similarity index 100% rename from _posts/08-04-01-Data-Filtering.md rename to _posts/09-04-01-Data-Filtering.md diff --git a/_posts/08-05-01-Configuration-Files.md b/_posts/09-05-01-Configuration-Files.md similarity index 100% rename from _posts/08-05-01-Configuration-Files.md rename to _posts/09-05-01-Configuration-Files.md diff --git a/_posts/08-06-01-Register-Globals.md b/_posts/09-06-01-Register-Globals.md similarity index 100% rename from _posts/08-06-01-Register-Globals.md rename to _posts/09-06-01-Register-Globals.md diff --git a/_posts/08-07-01-Error-Reporting.md b/_posts/09-07-01-Error-Reporting.md similarity index 100% rename from _posts/08-07-01-Error-Reporting.md rename to _posts/09-07-01-Error-Reporting.md diff --git a/_posts/09-01-01-Testing.md b/_posts/10-01-01-Testing.md similarity index 100% rename from _posts/09-01-01-Testing.md rename to _posts/10-01-01-Testing.md diff --git a/_posts/09-02-01-Test-Driven-Development.md b/_posts/10-02-01-Test-Driven-Development.md similarity index 100% rename from _posts/09-02-01-Test-Driven-Development.md rename to _posts/10-02-01-Test-Driven-Development.md diff --git a/_posts/09-03-01-Behavior-Driven-Development.md b/_posts/10-03-01-Behavior-Driven-Development.md similarity index 100% rename from _posts/09-03-01-Behavior-Driven-Development.md rename to _posts/10-03-01-Behavior-Driven-Development.md diff --git a/_posts/09-04-01-Complementary-Testing-Tools.md b/_posts/10-04-01-Complementary-Testing-Tools.md similarity index 100% rename from _posts/09-04-01-Complementary-Testing-Tools.md rename to _posts/10-04-01-Complementary-Testing-Tools.md diff --git a/_posts/10-01-01-Servers-and-Deployment.md b/_posts/11-01-01-Servers-and-Deployment.md similarity index 100% rename from _posts/10-01-01-Servers-and-Deployment.md rename to _posts/11-01-01-Servers-and-Deployment.md diff --git a/_posts/10-02-01-Platform-as-a-Service.md b/_posts/11-02-01-Platform-as-a-Service.md similarity index 100% rename from _posts/10-02-01-Platform-as-a-Service.md rename to _posts/11-02-01-Platform-as-a-Service.md diff --git a/_posts/10-03-01-Virtual-or-Dedicated-Servers.md b/_posts/11-03-01-Virtual-or-Dedicated-Servers.md similarity index 100% rename from _posts/10-03-01-Virtual-or-Dedicated-Servers.md rename to _posts/11-03-01-Virtual-or-Dedicated-Servers.md diff --git a/_posts/10-04-01-Shared-Servers.md b/_posts/11-04-01-Shared-Servers.md similarity index 100% rename from _posts/10-04-01-Shared-Servers.md rename to _posts/11-04-01-Shared-Servers.md diff --git a/_posts/10-05-01-Building-your-Application.md b/_posts/11-05-01-Building-your-Application.md similarity index 100% rename from _posts/10-05-01-Building-your-Application.md rename to _posts/11-05-01-Building-your-Application.md diff --git a/_posts/11-01-01-Caching.md b/_posts/12-01-01-Caching.md similarity index 100% rename from _posts/11-01-01-Caching.md rename to _posts/12-01-01-Caching.md diff --git a/_posts/11-02-01-Bytecode-Cache.md b/_posts/12-02-01-Bytecode-Cache.md similarity index 100% rename from _posts/11-02-01-Bytecode-Cache.md rename to _posts/12-02-01-Bytecode-Cache.md diff --git a/_posts/11-03-01-Object-Caching.md b/_posts/12-03-01-Object-Caching.md similarity index 100% rename from _posts/11-03-01-Object-Caching.md rename to _posts/12-03-01-Object-Caching.md diff --git a/_posts/12-01-01-Resources.md b/_posts/13-01-01-Resources.md similarity index 100% rename from _posts/12-01-01-Resources.md rename to _posts/13-01-01-Resources.md diff --git a/_posts/12-02-01-Frameworks.md b/_posts/13-02-01-Frameworks.md similarity index 100% rename from _posts/12-02-01-Frameworks.md rename to _posts/13-02-01-Frameworks.md diff --git a/_posts/12-03-01-Components.md b/_posts/13-03-01-Components.md similarity index 100% rename from _posts/12-03-01-Components.md rename to _posts/13-03-01-Components.md diff --git a/_posts/13-01-01-Community.md b/_posts/14-01-01-Community.md similarity index 100% rename from _posts/13-01-01-Community.md rename to _posts/14-01-01-Community.md From 79334026462b892c8a984708ddb4bc9e36d471c2 Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Tue, 26 Nov 2013 14:37:09 +0000 Subject: [PATCH 15/60] Missed a rename --- _posts/{08-01-01-Databases.md => 07-01-01-Databases.md} | 0 ...Errors-and-Exceptions.md => 08-01-01-Errors-and-Exceptions.md} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename _posts/{08-01-01-Databases.md => 07-01-01-Databases.md} (100%) rename _posts/{07-01-01-Errors-and-Exceptions.md => 08-01-01-Errors-and-Exceptions.md} (100%) diff --git a/_posts/08-01-01-Databases.md b/_posts/07-01-01-Databases.md similarity index 100% rename from _posts/08-01-01-Databases.md rename to _posts/07-01-01-Databases.md diff --git a/_posts/07-01-01-Errors-and-Exceptions.md b/_posts/08-01-01-Errors-and-Exceptions.md similarity index 100% rename from _posts/07-01-01-Errors-and-Exceptions.md rename to _posts/08-01-01-Errors-and-Exceptions.md From 192a207e2db94a2050b025e168b4a729fef4a517 Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Thu, 28 Nov 2013 12:17:44 +0000 Subject: [PATCH 16/60] First draft - Resolves #280 --- _posts/06-01-01-Dependency-Injection.md | 8 ++++ _posts/06-02-01-Basic-Concept.md | 57 +++++++++++++++++++++++++ _posts/06-03-01-Complex-Problem.md | 49 +++++++++++++++++++++ _posts/06-04-01-Containers.md | 14 ++++++ _posts/06-05-01-Further-Reading.md | 11 +++++ 5 files changed, 139 insertions(+) create mode 100644 _posts/06-01-01-Dependency-Injection.md create mode 100644 _posts/06-02-01-Basic-Concept.md create mode 100644 _posts/06-03-01-Complex-Problem.md create mode 100644 _posts/06-04-01-Containers.md create mode 100644 _posts/06-05-01-Further-Reading.md diff --git a/_posts/06-01-01-Dependency-Injection.md b/_posts/06-01-01-Dependency-Injection.md new file mode 100644 index 0000000..3bac06e --- /dev/null +++ b/_posts/06-01-01-Dependency-Injection.md @@ -0,0 +1,8 @@ +--- +title: Dependency Injection +--- + +# Dependency Injection {#dependency_injection_title} + +Dependency Injection is a basic concept that solves a complex problem. As a software design pattern it is being adopted in +some way or another by all major PHP projects. diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md new file mode 100644 index 0000000..1748afe --- /dev/null +++ b/_posts/06-02-01-Basic-Concept.md @@ -0,0 +1,57 @@ +--- +isChild: true +--- + +## Basic Concept {#basic_concept_title} + +From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): + +> 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 component +with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. + +We can demonstrate the concept with a simple, yet naive, example. + +{% highlight php %} +adapter = new MySqlAdapter; + } +} + +class MysqlAdapter {} +{% endhighlight %} + +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This code can be refactored to use Dependency Injection +and therefore loosen the dependency. + +{% highlight php %} +adapter = $adapter; + } +} + +class MysqlAdapter {} +{% endhighlight %} + +Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could +set it directly. diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md new file mode 100644 index 0000000..07050d2 --- /dev/null +++ b/_posts/06-03-01-Complex-Problem.md @@ -0,0 +1,49 @@ +--- +isChild: true +--- + +## Complex Problem {#complex_problem_title} + +If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. +These are the complex problems that Dependency Injection solves, or to be more precise, elegantly solves. + +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 that other +controllers must extend to gain access to it's 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. + +Dependency Inversion Principle is the "D" in the S.O.L.I.D 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. + +{% highlight php %} +adapter = $adapter; + } +} + +interface AdapterInterface {} + +class MysqlAdapter implements AdapterInterface {} +{% endhighlight %} + +There are several benefits to the Database class now depending on an interface rather than a concretion. + +Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have +to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency +is an interface/contract we can happily mock that interface knowing that our colleague will build the adapter based on that contract. + +An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we +want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, +no more refactoring would be required as we can ensure that the adapter follows the contract set by the interface. diff --git a/_posts/06-04-01-Containers.md b/_posts/06-04-01-Containers.md new file mode 100644 index 0000000..b3eca74 --- /dev/null +++ b/_posts/06-04-01-Containers.md @@ -0,0 +1,14 @@ +--- +isChild: true +--- + +## Containers {#containers_title} + +The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency +Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often +are misused to implement an anti pattern, Service Location. Using a container as a Service Locator within your classes arguably +creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent +and ultimately harder to test. + +Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. +What this means in practice is that you can write application code that is as clean and de-coupled as the framework it is built on. diff --git a/_posts/06-05-01-Further-Reading.md b/_posts/06-05-01-Further-Reading.md new file mode 100644 index 0000000..e1d3645 --- /dev/null +++ b/_posts/06-05-01-Further-Reading.md @@ -0,0 +1,11 @@ +--- +isChild: true +--- + +## Further Reading {#further_reading_title} + +- [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](http://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://www.happyaccidents.me/dependency-injection-as-a-tool-for-testing/) From ea4a6bebe236b7437cd0afba54233204cb3ef83e Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Thu, 28 Nov 2013 14:00:56 +0000 Subject: [PATCH 17/60] Revisions --- _posts/06-01-01-Dependency-Injection.md | 9 +++++++-- _posts/06-02-01-Basic-Concept.md | 16 +++++----------- _posts/06-03-01-Complex-Problem.md | 9 ++++++++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/_posts/06-01-01-Dependency-Injection.md b/_posts/06-01-01-Dependency-Injection.md index 3bac06e..e69c4a2 100644 --- a/_posts/06-01-01-Dependency-Injection.md +++ b/_posts/06-01-01-Dependency-Injection.md @@ -4,5 +4,10 @@ title: Dependency Injection # Dependency Injection {#dependency_injection_title} -Dependency Injection is a basic concept that solves a complex problem. As a software design pattern it is being adopted in -some way or another by all major PHP projects. +From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): + +> 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 component +with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 1748afe..520415b 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -4,15 +4,11 @@ isChild: true ## Basic Concept {#basic_concept_title} -From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): +We can demonstrate the concept with a simple, yet naive. -> 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 component -with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. - -We can demonstrate the concept with a simple, yet naive, example. +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is +very tightly coupled to the adapter. {% highlight php %} Date: Fri, 29 Nov 2013 09:46:15 +0000 Subject: [PATCH 18/60] Typos and further change re comments --- _posts/06-03-01-Complex-Problem.md | 26 +++++++++++++------------- _posts/06-04-01-Containers.md | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md index 69e69fb..9fd0f21 100644 --- a/_posts/06-03-01-Complex-Problem.md +++ b/_posts/06-03-01-Complex-Problem.md @@ -4,26 +4,26 @@ isChild: true ## Complex Problem {#complex_problem_title} -If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. +If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. These are the complex problems that Dependency Injection solves. ### Inversion of Control -Inversion of Control is as it says, "inverting the control" of a system by keeping organisational control entirely separate from our objects. +Inversion of Control is as it says, "inverting the control" of a system by keeping organisational 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. -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 that other -controllers must extend to gain access to it's dependencies. This **is** Inversion of Control, however, instead of loosening +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 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, +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 -Dependency Inversion Principle is the "D" in the S.O.L.I.D 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 +Dependency Inversion Principle is the "D" in the S.O.L.I.D 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. {% highlight php %} @@ -45,12 +45,12 @@ interface AdapterInterface {} class MysqlAdapter implements AdapterInterface {} {% endhighlight %} -There are several benefits to the Database class now depending on an interface rather than a concretion. +There are several benefits to the `Database` class now depending on an interface rather than a concretion. -Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have -to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency +Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have +to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency is an interface/contract we can happily mock that interface knowing that our colleague will build the adapter based on that contract. -An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we -want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, +An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we +want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, no more refactoring would be required as we can ensure that the adapter follows the contract set by the interface. diff --git a/_posts/06-04-01-Containers.md b/_posts/06-04-01-Containers.md index b3eca74..f0e5466 100644 --- a/_posts/06-04-01-Containers.md +++ b/_posts/06-04-01-Containers.md @@ -4,11 +4,11 @@ isChild: true ## Containers {#containers_title} -The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency -Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often -are misused to implement an anti pattern, Service Location. Using a container as a Service Locator within your classes arguably -creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent +The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency +Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often +are misused to implement an anti-pattern, Service Location. Injecting a DI container as a Service Locator in to your classes arguably +creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent and ultimately harder to test. -Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. +Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. What this means in practice is that you can write application code that is as clean and de-coupled as the framework it is built on. From fd21b24e3f48a2f9e9880eb22b1a9ed222e0b210 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 29 Nov 2013 11:56:00 -0500 Subject: [PATCH 19/60] Fix DI typo --- _posts/06-02-01-Basic-Concept.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 520415b..727ba7a 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -4,10 +4,10 @@ isChild: true ## Basic Concept {#basic_concept_title} -We can demonstrate the concept with a simple, yet naive. +We can demonstrate the concept with a simple, yet naive example. -Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the -adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is very tightly coupled to the adapter. {% highlight php %} @@ -46,6 +46,6 @@ class Database class MysqlAdapter {} {% endhighlight %} -Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method -that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could +Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could set it directly. From 81ae63d5da54184d0dc85c2c90b4dae2c0ac039f Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 29 Nov 2013 11:57:23 -0500 Subject: [PATCH 20/60] Fix DI typo --- _posts/06-02-01-Basic-Concept.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 727ba7a..fb9954b 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -46,6 +46,6 @@ class Database class MysqlAdapter {} {% endhighlight %} -Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +Now we are giving the `Database` class its dependency rather than it creating it itself. We could even create a method that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could set it directly. From 3bd78009eb2b1e16f64cf00f3158f789d9c5f1fc Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 2 Dec 2013 10:23:11 -0500 Subject: [PATCH 21/60] Fixed link for Enhance PHP Thanks to @w00 for pointing this one out in #332. --- _posts/10-02-01-Test-Driven-Development.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_posts/10-02-01-Test-Driven-Development.md b/_posts/10-02-01-Test-Driven-Development.md index f6571d4..71528d6 100644 --- a/_posts/10-02-01-Test-Driven-Development.md +++ b/_posts/10-02-01-Test-Driven-Development.md @@ -30,10 +30,11 @@ you run a project which accepts pull requests then you should suggest this as a [PHPUnit](http://phpunit.de) is the de-facto testing framework for writing unit tests for PHP applications, but there are several alternatives -* [SimpleTest](http://simpletest.org) -* [Enhance PHP](http://www.enhance-php.com/) -* [PUnit](http://punit.smf.me.uk/) * [atoum](https://github.com/atoum/atoum) +* [Enhance PHP](https://github.com/Enhance-PHP/Enhance-PHP) +* [PUnit](http://punit.smf.me.uk/) +* [SimpleTest](http://simpletest.org) + ### Integration Testing From 67df3eb54e7e20e9310ca05657f12f8e2bff4d47 Mon Sep 17 00:00:00 2001 From: Ryan Koven Date: Tue, 3 Dec 2013 13:45:16 -0800 Subject: [PATCH 22/60] Remove an extraneous 'to'; rectify an instance of an incorrect verb tense; small adjust to punctuation. Original text noted that it's "usually a good idea to follow to common patterns". Removed extra 'to'. In MVC section the sentence "The model-view-controller (MVC) pattern... let..." should be changed to "The model-view-controller (MVC) pattern...lets..." Also added a semicolon to a sentence in the Factory section that Strunk and White would agree enhances the clarity of the sentence. --- pages/Design-Patterns.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 4a3fe45..64618c2 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -6,7 +6,7 @@ title: Design Patterns # Design Patterns There are numerous ways to structure the code and project for you web application, and you can put as much or as little -thought as you like into architecting. But it is usually a good idea to follow to common patterns because it will make +thought as you like into architecting. But it is usually a good idea to follow common patterns because it will make your code easier to manage and easier for others to understand. * [Architectural pattern on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern) @@ -51,7 +51,7 @@ print_r($veyron->get_make_and_model()); // outputs "Bugatti Veyron" {% endhighlight %} This code uses a factory to create the Automobile object. There are two possible benefits to building your code this -way, the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you +way; the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you will only have to modify the code in the factory, instead of every place in your project that uses the Automobile class. The second possible benefit is that if creating the object is a complicated job you can do all of the work in the factory, instead of repeating it every time you want to create a new instance. @@ -250,11 +250,7 @@ and gives you a central place to hook in code that should be run for every reque ## Model-View-Controller -The model-view-controller (MVC) pattern and its relatives HMVC and MVVM let you break up code into logical objects that -serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable -throughout your application. Controllers handle the request, process the data returned from models and load views to -send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web -browser. +The model-view-controller (MVC) pattern and its relatives HMVC and MVVM lets you break up code into logical objects that serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable throughout your application. Controllers handle the request, process the data returned from models and load views to send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web browser. MVC is the most common architectural pattern used in the popular [PHP frameworks](https://github.com/codeguy/php-the-right-way/wiki/Frameworks). From 9bca711909bfcb893e7f949d46474c98aa43befb Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Sat, 7 Dec 2013 20:12:02 +0800 Subject: [PATCH 23/60] higher order functions Functions using functions as input and/or output are higher order functions. --- pages/Functional-Programming.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/Functional-Programming.md b/pages/Functional-Programming.md index f9dc9a0..f5eb792 100644 --- a/pages/Functional-Programming.md +++ b/pages/Functional-Programming.md @@ -7,14 +7,14 @@ title: Functional Programming in PHP 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 (a feature called higher-order functions) and a function can return other functions. +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. Anonymous functions (with support for closures) have been present since PHP 5.3 (2009). -PHP 5.4 added the ability to bind closures to an object's scope and also improved support for callables such that they +PHP 5.4 added the ability to bind closures to an object's scope and also improved support for callables such that they can be used interchangeably with anonymous functions in almost all cases. The most common usage of higher-order functions is when implementing a strategy pattern. The built-in `array_filter` From c406b927230a61d6daeff384fc771500224f7228 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 7 Dec 2013 09:26:04 -0500 Subject: [PATCH 24/60] Updated mwop's Twitter account --- _posts/13-01-01-Resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-01-01-Resources.md b/_posts/13-01-01-Resources.md index 3837fbc..9466aa5 100644 --- a/_posts/13-01-01-Resources.md +++ b/_posts/13-01-01-Resources.md @@ -12,7 +12,7 @@ * [Derick Rethans](http://twitter.com/derickr) * [Chris Shiflett](http://twitter.com/shiflett) * [Sebastian Bergmann](http://twitter.com/s_bergmann) -* [Matthew Weier O'Phinney](http://twitter.com/weierophinney) +* [Matthew Weier O'Phinney](http://twitter.com/mwop) * [Pádraic Brady](http://twitter.com/padraicb) * [Anthony Ferrara](http://twitter.com/ircmaxell) * [Nikita Popov](http://twitter.com/nikita_ppv) From 710cba2569c15d94127438a21a05ea7e2bceaf83 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 8 Dec 2013 16:02:22 +0100 Subject: [PATCH 25/60] coding style fix --- _posts/07-01-01-Databases.md | 2 +- _posts/09-03-01-Password-Hashing.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 5f024fa..7f37417 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -45,7 +45,7 @@ which will delete all of your users! Instead, you should sanitize the ID input u prepare('SELECT name FROM users WHERE id = :id'); -$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatically sanitized by PDO +$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); // <-- Automatically sanitized by PDO $stmt->execute(); {% endhighlight %} diff --git a/_posts/09-03-01-Password-Hashing.md b/_posts/09-03-01-Password-Hashing.md index cf9f544..ad82acd 100644 --- a/_posts/09-03-01-Password-Hashing.md +++ b/_posts/09-03-01-Password-Hashing.md @@ -22,9 +22,9 @@ require 'password.php'; $passwordHash = password_hash('secret-password', PASSWORD_DEFAULT); if (password_verify('bad-password', $passwordHash)) { - //Correct Password + // Correct Password } else { - //Wrong password + // Wrong password } {% endhighlight %} From 346e3fabdef5fee80bb8d411b219d39fbbc4b5f4 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 2 Nov 2013 23:57:11 +0100 Subject: [PATCH 26/60] link to openshift fixed --- _posts/13-01-01-Resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-01-01-Resources.md b/_posts/13-01-01-Resources.md index 9466aa5..61c42fe 100644 --- a/_posts/13-01-01-Resources.md +++ b/_posts/13-01-01-Resources.md @@ -29,7 +29,7 @@ (PHP support is undocumented but based on stable Facebook partnership [link](http://net.tutsplus.com/tutorials/php/quick-tip-deploy-php-to-heroku-in-seconds/)) * [fortrabbit](http://fortrabbit.com/) * [Engine Yard Cloud](https://www.engineyard.com/products/cloud) -* [Red Hat OpenShift Platform](http://www.redhat.com/products/cloud-computing/openshift/) +* [Red Hat OpenShift Platform](http://openshift.com) * [dotCloud](http://docs.dotcloud.com/services/php/) * [AWS Elastic Beanstalk](http://aws.amazon.com/elasticbeanstalk/) * [cloudControl](https://www.cloudcontrol.com/) From eb3cdfcbf65b72205c7d5360362051218bdaa5c1 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 13 Dec 2013 12:10:23 -0500 Subject: [PATCH 27/60] Update GA snippet --- _layouts/default.html | 2 +- _layouts/page.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index aeb97c5..863dfa8 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -23,7 +23,7 @@ _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); diff --git a/_layouts/page.html b/_layouts/page.html index a3556b9..9c22aab 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -22,7 +22,7 @@ _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); From 371e113a91e4ba54e9a4f6e5a3c5b4b7405a24ac Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 8 Jan 2014 23:12:03 -0500 Subject: [PATCH 28/60] Added a note about VersionEye for Composer --- _posts/04-02-01-Composer-and-Packagist.md | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index fc67e0b..8cafc09 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -36,16 +36,18 @@ The path `$HOME/local/bin` (or a directory of your choice) should be in your `$P When you come across documentation that states to run Composer as `php composer.phar install`, you can substitute that with: composer install + +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 `php composer.phar 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][2] as a dependency of your project. Run it in your project's root directory where you've downloaded `composer.phar`: +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 and if you don't have a `composer.json` file, one will be created. Here's an example that adds [Twig][2] as a dependency of your project. - php composer.phar require twig/twig:~1.8 + composer require twig/twig:~1.8 -Alternatively the `php composer.phar 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 `vendors/` directory. This also applies to projects you've downloaded that already provide a `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 `vendors/` directory. This also applies to projects you've downloaded that already provide a `composer.json` file: - php composer.phar install + composer install Next, add this line to your application's primary PHP file; this will tell PHP to use Composer's autoloader for your project dependencies. @@ -62,14 +64,20 @@ Composer creates a file called `composer.lock` which stores the exact version of 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 `php composer.phar update` command will upgrade all your dependencies to the newest version that fits the restrictions you define. +### Update Notifcations + +To receive notifications about new version releases you can sign up for [VersionEye][3], a web service that can monitor +your GitHub and BitBucket accounts for `composer.json` files and send emails with new package releases. + ### Checking your dependencies for security issues -The [Security Advisories Checker][3] is a web service and a command-line tool, both will examine your `composer.lock` file and tell you if you need to update any of your dependencies. +The [Security Advisories Checker][4] is a web service and a command-line tool, both will examine your `composer.lock` file and tell you if you need to update any of your dependencies. -* [Learn about Composer][4] +* [Learn about Composer][5] [1]: http://packagist.org/ [2]: http://twig.sensiolabs.org -[3]: https://security.sensiolabs.org/ -[4]: http://getcomposer.org/doc/00-intro.md +[3]: https://www.versioneye.com/ +[4]: https://security.sensiolabs.org/ +[5]: http://getcomposer.org/doc/00-intro.md From 575297558681c212c0129340ee69b4e1db4e92bd Mon Sep 17 00:00:00 2001 From: Antonio Spinelli Date: Fri, 17 Jan 2014 10:42:14 -0200 Subject: [PATCH 29/60] Composer and Pakagist, fix typo --- _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 8cafc09..0d45435 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -64,7 +64,7 @@ Composer creates a file called `composer.lock` which stores the exact version of 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 `php composer.phar update` command will upgrade all your dependencies to the newest version that fits the restrictions you define. -### Update Notifcations +### Update Notifications To receive notifications about new version releases you can sign up for [VersionEye][3], a web service that can monitor your GitHub and BitBucket accounts for `composer.json` files and send emails with new package releases. From 960a5c529237025e1901cdf12dcda3ee70430718 Mon Sep 17 00:00:00 2001 From: kfuchs Date: Fri, 31 Jan 2014 10:31:45 -0500 Subject: [PATCH 30/60] Added Propel to the list --- _posts/07-01-01-Databases.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 7f37417..31ee070 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -73,6 +73,7 @@ Some abstraction layers have been built using the PSR-0 namespace standard so ca * [Aura SQL][6] * [Doctrine2 DBAL][2] +* [Propel][7] * [ZF2 Db][4] * [ZF1 Db][3] @@ -82,6 +83,7 @@ Some abstraction layers have been built using the PSR-0 namespace standard so ca [4]: http://packages.zendframework.com/docs/latest/manual/en/index.html#zend-db [5]: http://php.net/manual/en/pdo.connections.php [6]: https://github.com/auraphp/Aura.Sql +[7]: http://propelorm.org/Propel/ [mysql]: http://php.net/mysql [mysqli]: http://php.net/mysqli From 822da9c725bae26e08b369d6f4ca2267fb0343cc Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 31 Jan 2014 16:57:28 -0500 Subject: [PATCH 31/60] Hi PSR-0, this is PSR-4. I'm coming for you. --- _posts/02-01-01-Code-Style-Guide.md | 10 ++++++---- _posts/03-03-01-Namespaces.md | 22 ++++++++++++++++++---- _posts/07-01-01-Databases.md | 4 +++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index f7a6d0c..099d09b 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -5,10 +5,10 @@ PHP developers to choose several of these and combine them into a single project (as close as possible) to a common code style to make it easy for developers to mix and match various libraries for their projects. -The [Framework Interop Group][fig] has proposed and approved a series of style recommendations, known as [PSR-0][psr0], -[PSR-1][psr1] and [PSR-2][psr2]. Don't let the funny names confuse you, 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 personal style. +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 personal style. Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSR's, or one of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, @@ -17,6 +17,7 @@ and applications that implement the components can have consistency even when wo * [Read about PSR-0][psr0] * [Read about PSR-1][psr1] * [Read about PSR-2][psr2] +* [Read about PSR-4][psr4] * [Read about PEAR Coding Standards][pear-cs] * [Read about Zend Coding Standards][zend-cs] * [Read about Symfony Coding Standards][symfony-cs] @@ -34,6 +35,7 @@ by all current and future parties who may be working on the codebase. [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 [pear-cs]: http://pear.php.net/manual/en/standards.php [zend-cs]: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards [symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index bc6eed8..3f1fc23 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -4,16 +4,30 @@ isChild: true ## 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 and cause trouble. +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 and cause trouble. -_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared to operating system directories that _namespace_ files; two files with the same name may co-exist in separate directories. Likewise, two PHP classes with the same name may co-exist in separate PHP namespaces. It's as simple as that. +_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared +to operating system directories that _namespace_ files; two files with the same name may co-exist in +separate directories. Likewise, two PHP classes with the same name may co-exist in separate PHP +namespaces. It's as simple as that. -It is important for you to namespace your code so that it may be used by other developers without fear of colliding with other libraries. +It is important for you to namespace your code so that it may be used by other developers without fear +of colliding with other libraries. -One recommended way to use namespaces is outlined in [PSR-0][psr0], which aims to provide a standard file, class and namespace convention to allow plug-and-play code. +One recommended way to use namespaces is outlined in [PSR-0][psr0], which aims to provide a standard file, +class and namespace convention to allow plug-and-play code. + +In December 2013 the PHP-FIG created a new autoloading standard: [PSR-4][psr4], which one day will +probably replace PSR-0. Currently both are still usable, as PSR-4 required PHP 5.3 and many PHP 5.2-only +projects currently 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. * [Read about Namespaces][namespaces] * [Read about PSR-0][psr0] +* [Read about PSR-4][psr4] [namespaces]: http://php.net/manual/en/language.namespaces.php [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 \ No newline at end of file diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 31ee070..17c5e51 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -69,7 +69,7 @@ one database system that another is missing from another by wrapping your querie This will of course add a little overhead, but if you are building a portable application that needs to work with MySQL, PostgreSQL and SQLite then a little overhead will be worth it the sake of code cleanliness. -Some abstraction layers have been built using the PSR-0 namespace standard so can be installed in any application you like: +Some abstraction layers have been built using the [PSR-0][psr0] or [PSR-4][psr4] namespace standards so can be installed in any application you like: * [Aura SQL][6] * [Doctrine2 DBAL][2] @@ -88,3 +88,5 @@ Some abstraction layers have been built using the PSR-0 namespace standard so ca [mysql]: http://php.net/mysql [mysqli]: http://php.net/mysqli [pgsql]: http://php.net/pgsql +[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 From 3de54f0946593c6dd78e0bee91cace30a94bc07b Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 31 Jan 2014 16:58:37 -0500 Subject: [PATCH 32/60] s/d/s. --- _posts/03-03-01-Namespaces.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/03-03-01-Namespaces.md b/_posts/03-03-01-Namespaces.md index 3f1fc23..23c7280 100644 --- a/_posts/03-03-01-Namespaces.md +++ b/_posts/03-03-01-Namespaces.md @@ -20,7 +20,7 @@ One recommended way to use namespaces is outlined in [PSR-0][psr0], which aims t class and namespace convention to allow plug-and-play code. In December 2013 the PHP-FIG created a new autoloading standard: [PSR-4][psr4], which one day will -probably replace PSR-0. Currently both are still usable, as PSR-4 required PHP 5.3 and many PHP 5.2-only +probably replace PSR-0. Currently both are still usable, as PSR-4 requires PHP 5.3 and many PHP 5.2-only projects currently 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. From 90ff4d657b91859af58252cda09f3321361601ee Mon Sep 17 00:00:00 2001 From: kenden Date: Tue, 8 Oct 2013 13:47:59 +0200 Subject: [PATCH 33/60] Update 09-04-01-Complementary-Testing-Tools.md Updating link to the PHPUnit-Selenium integration page to the current version of PHPUnit --- _posts/09-04-01-Complementary-Testing-Tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/09-04-01-Complementary-Testing-Tools.md b/_posts/09-04-01-Complementary-Testing-Tools.md index 034937a..1cbc304 100644 --- a/_posts/09-04-01-Complementary-Testing-Tools.md +++ b/_posts/09-04-01-Complementary-Testing-Tools.md @@ -8,6 +8,6 @@ Besides individual testing and behavior driven frameworks, there are also a numb ### Tool Links -* [Selenium](http://seleniumhq.org/) is a browser automation tool which can be [integrated with PHPUnit](http://www.phpunit.de/manual/3.1/en/selenium.html) +* [Selenium](http://seleniumhq.org/) is a browser automation tool which can be [integrated with PHPUnit](http://phpunit.de/manual/current/en/selenium.html) * [Mockery](https://github.com/padraic/mockery) is a Mock Object Framework which can be integrated with [PHPUnit](http://phpunit.de/) or [PHPSpec](http://www.phpspec.net/) * [Prophecy](https://github.com/phpspec/prophecy) is a highly opinionated yet very powerful and flexible PHP object mocking framework. It's integrated with [PHPSpec](http://www.phpspec.net/) and can be used with [PHPUnit](http://phpunit.de/). From 6a875d46774a2925d345ef230e29dbd05bd9b728 Mon Sep 17 00:00:00 2001 From: Jacek Kobus Date: Tue, 8 Oct 2013 22:27:05 +0200 Subject: [PATCH 34/60] added link to symfony coding standards --- _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 e9d4657..f7a6d0c 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -19,6 +19,7 @@ and applications that implement the components can have consistency even when wo * [Read about PSR-2][psr2] * [Read about PEAR Coding Standards][pear-cs] * [Read about Zend Coding Standards][zend-cs] +* [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. @@ -35,6 +36,7 @@ by all current and future parties who may be working on the codebase. [psr2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [pear-cs]: http://pear.php.net/manual/en/standards.php [zend-cs]: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards +[symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ From 8ae8f569454e5da352785c97ec61cfd09fe8b2d4 Mon Sep 17 00:00:00 2001 From: Matthew Malinowski Date: Wed, 6 Nov 2013 10:03:23 -0500 Subject: [PATCH 35/60] Add Mavericks PHP version to Mac Setup. --- _posts/01-04-01-Mac-Setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/01-04-01-Mac-Setup.md b/_posts/01-04-01-Mac-Setup.md index c394dea..aa2fa29 100644 --- a/_posts/01-04-01-Mac-Setup.md +++ b/_posts/01-04-01-Mac-Setup.md @@ -4,8 +4,8 @@ isChild: true ## Mac Setup {#mac_setup_title} -OSX comes prepackaged with PHP but it is normally a little behind the latest stable. Lion comes with PHP 5.3.6 and -Mountain Lion has 5.3.10. +OSX comes prepackaged with PHP but it is normally a little behind the latest stable. Lion comes with PHP 5.3.6, +Mountain Lion has 5.3.10, and Mavericks has 5.4.17. To update PHP on OSX you can get it installed through a number of Mac [package managers][mac-package-managers], with [php-osx by Liip][php-osx-downloads] being recommended. From 12414b2f6cf528ab1109818474fd60b53555e16a Mon Sep 17 00:00:00 2001 From: Alastair Hole Date: Wed, 20 Nov 2013 16:29:44 +0000 Subject: [PATCH 36/60] Update 03-06-01-XDebug.md Corrected MacGBDp to MacGDBp --- _posts/03-06-01-XDebug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/03-06-01-XDebug.md b/_posts/03-06-01-XDebug.md index 402eb1e..8334b5c 100644 --- a/_posts/03-06-01-XDebug.md +++ b/_posts/03-06-01-XDebug.md @@ -31,7 +31,7 @@ Your IDE will now intercept the current state as the script executes, allowing y values in memory. Graphical debuggers make it very easy to step through code, inspect variables, and eval code against the live runtime. -Many IDE's have built-in or plugin-based support for graphical debugging with xdebug. MacGBDp is a free, open-source, +Many IDE's have built-in or plugin-based support for graphical debugging with xdebug. MacGDBp is a free, open-source, stand-alone xdebug GUI for Mac. * [Learn more about XDebug][xdebug-docs] From 688ef4f99fe8bc42c156149e42988712ad280a34 Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Tue, 26 Nov 2013 14:35:06 +0000 Subject: [PATCH 37/60] Renamed posts to allow Dependency Injection to be added --- _posts/{06-01-01-Databases.md => 08-01-01-Databases.md} | 0 _posts/{07-02-01-Errors.md => 08-02-01-Errors.md} | 0 _posts/{07-03-01-Exceptions.md => 08-03-01-Exceptions.md} | 0 _posts/{08-01-01-Security.md => 09-01-01-Security.md} | 0 ...plication-Security.md => 09-02-01-Web-Application-Security.md} | 0 ...{08-03-01-Password-Hashing.md => 09-03-01-Password-Hashing.md} | 0 _posts/{08-04-01-Data-Filtering.md => 09-04-01-Data-Filtering.md} | 0 ...-01-Configuration-Files.md => 09-05-01-Configuration-Files.md} | 0 ...{08-06-01-Register-Globals.md => 09-06-01-Register-Globals.md} | 0 .../{08-07-01-Error-Reporting.md => 09-07-01-Error-Reporting.md} | 0 _posts/{09-01-01-Testing.md => 10-01-01-Testing.md} | 0 ...-Driven-Development.md => 10-02-01-Test-Driven-Development.md} | 0 ...ven-Development.md => 10-03-01-Behavior-Driven-Development.md} | 0 ...y-Testing-Tools.md => 10-04-01-Complementary-Testing-Tools.md} | 0 ...rvers-and-Deployment.md => 11-01-01-Servers-and-Deployment.md} | 0 ...Platform-as-a-Service.md => 11-02-01-Platform-as-a-Service.md} | 0 ...icated-Servers.md => 11-03-01-Virtual-or-Dedicated-Servers.md} | 0 _posts/{10-04-01-Shared-Servers.md => 11-04-01-Shared-Servers.md} | 0 ...-your-Application.md => 11-05-01-Building-your-Application.md} | 0 _posts/{11-01-01-Caching.md => 12-01-01-Caching.md} | 0 _posts/{11-02-01-Bytecode-Cache.md => 12-02-01-Bytecode-Cache.md} | 0 _posts/{11-03-01-Object-Caching.md => 12-03-01-Object-Caching.md} | 0 _posts/{12-01-01-Resources.md => 13-01-01-Resources.md} | 0 _posts/{12-02-01-Frameworks.md => 13-02-01-Frameworks.md} | 0 _posts/{12-03-01-Components.md => 13-03-01-Components.md} | 0 _posts/{13-01-01-Community.md => 14-01-01-Community.md} | 0 26 files changed, 0 insertions(+), 0 deletions(-) rename _posts/{06-01-01-Databases.md => 08-01-01-Databases.md} (100%) rename _posts/{07-02-01-Errors.md => 08-02-01-Errors.md} (100%) rename _posts/{07-03-01-Exceptions.md => 08-03-01-Exceptions.md} (100%) rename _posts/{08-01-01-Security.md => 09-01-01-Security.md} (100%) rename _posts/{08-02-01-Web-Application-Security.md => 09-02-01-Web-Application-Security.md} (100%) rename _posts/{08-03-01-Password-Hashing.md => 09-03-01-Password-Hashing.md} (100%) rename _posts/{08-04-01-Data-Filtering.md => 09-04-01-Data-Filtering.md} (100%) rename _posts/{08-05-01-Configuration-Files.md => 09-05-01-Configuration-Files.md} (100%) rename _posts/{08-06-01-Register-Globals.md => 09-06-01-Register-Globals.md} (100%) rename _posts/{08-07-01-Error-Reporting.md => 09-07-01-Error-Reporting.md} (100%) rename _posts/{09-01-01-Testing.md => 10-01-01-Testing.md} (100%) rename _posts/{09-02-01-Test-Driven-Development.md => 10-02-01-Test-Driven-Development.md} (100%) rename _posts/{09-03-01-Behavior-Driven-Development.md => 10-03-01-Behavior-Driven-Development.md} (100%) rename _posts/{09-04-01-Complementary-Testing-Tools.md => 10-04-01-Complementary-Testing-Tools.md} (100%) rename _posts/{10-01-01-Servers-and-Deployment.md => 11-01-01-Servers-and-Deployment.md} (100%) rename _posts/{10-02-01-Platform-as-a-Service.md => 11-02-01-Platform-as-a-Service.md} (100%) rename _posts/{10-03-01-Virtual-or-Dedicated-Servers.md => 11-03-01-Virtual-or-Dedicated-Servers.md} (100%) rename _posts/{10-04-01-Shared-Servers.md => 11-04-01-Shared-Servers.md} (100%) rename _posts/{10-05-01-Building-your-Application.md => 11-05-01-Building-your-Application.md} (100%) rename _posts/{11-01-01-Caching.md => 12-01-01-Caching.md} (100%) rename _posts/{11-02-01-Bytecode-Cache.md => 12-02-01-Bytecode-Cache.md} (100%) rename _posts/{11-03-01-Object-Caching.md => 12-03-01-Object-Caching.md} (100%) rename _posts/{12-01-01-Resources.md => 13-01-01-Resources.md} (100%) rename _posts/{12-02-01-Frameworks.md => 13-02-01-Frameworks.md} (100%) rename _posts/{12-03-01-Components.md => 13-03-01-Components.md} (100%) rename _posts/{13-01-01-Community.md => 14-01-01-Community.md} (100%) diff --git a/_posts/06-01-01-Databases.md b/_posts/08-01-01-Databases.md similarity index 100% rename from _posts/06-01-01-Databases.md rename to _posts/08-01-01-Databases.md diff --git a/_posts/07-02-01-Errors.md b/_posts/08-02-01-Errors.md similarity index 100% rename from _posts/07-02-01-Errors.md rename to _posts/08-02-01-Errors.md diff --git a/_posts/07-03-01-Exceptions.md b/_posts/08-03-01-Exceptions.md similarity index 100% rename from _posts/07-03-01-Exceptions.md rename to _posts/08-03-01-Exceptions.md diff --git a/_posts/08-01-01-Security.md b/_posts/09-01-01-Security.md similarity index 100% rename from _posts/08-01-01-Security.md rename to _posts/09-01-01-Security.md diff --git a/_posts/08-02-01-Web-Application-Security.md b/_posts/09-02-01-Web-Application-Security.md similarity index 100% rename from _posts/08-02-01-Web-Application-Security.md rename to _posts/09-02-01-Web-Application-Security.md diff --git a/_posts/08-03-01-Password-Hashing.md b/_posts/09-03-01-Password-Hashing.md similarity index 100% rename from _posts/08-03-01-Password-Hashing.md rename to _posts/09-03-01-Password-Hashing.md diff --git a/_posts/08-04-01-Data-Filtering.md b/_posts/09-04-01-Data-Filtering.md similarity index 100% rename from _posts/08-04-01-Data-Filtering.md rename to _posts/09-04-01-Data-Filtering.md diff --git a/_posts/08-05-01-Configuration-Files.md b/_posts/09-05-01-Configuration-Files.md similarity index 100% rename from _posts/08-05-01-Configuration-Files.md rename to _posts/09-05-01-Configuration-Files.md diff --git a/_posts/08-06-01-Register-Globals.md b/_posts/09-06-01-Register-Globals.md similarity index 100% rename from _posts/08-06-01-Register-Globals.md rename to _posts/09-06-01-Register-Globals.md diff --git a/_posts/08-07-01-Error-Reporting.md b/_posts/09-07-01-Error-Reporting.md similarity index 100% rename from _posts/08-07-01-Error-Reporting.md rename to _posts/09-07-01-Error-Reporting.md diff --git a/_posts/09-01-01-Testing.md b/_posts/10-01-01-Testing.md similarity index 100% rename from _posts/09-01-01-Testing.md rename to _posts/10-01-01-Testing.md diff --git a/_posts/09-02-01-Test-Driven-Development.md b/_posts/10-02-01-Test-Driven-Development.md similarity index 100% rename from _posts/09-02-01-Test-Driven-Development.md rename to _posts/10-02-01-Test-Driven-Development.md diff --git a/_posts/09-03-01-Behavior-Driven-Development.md b/_posts/10-03-01-Behavior-Driven-Development.md similarity index 100% rename from _posts/09-03-01-Behavior-Driven-Development.md rename to _posts/10-03-01-Behavior-Driven-Development.md diff --git a/_posts/09-04-01-Complementary-Testing-Tools.md b/_posts/10-04-01-Complementary-Testing-Tools.md similarity index 100% rename from _posts/09-04-01-Complementary-Testing-Tools.md rename to _posts/10-04-01-Complementary-Testing-Tools.md diff --git a/_posts/10-01-01-Servers-and-Deployment.md b/_posts/11-01-01-Servers-and-Deployment.md similarity index 100% rename from _posts/10-01-01-Servers-and-Deployment.md rename to _posts/11-01-01-Servers-and-Deployment.md diff --git a/_posts/10-02-01-Platform-as-a-Service.md b/_posts/11-02-01-Platform-as-a-Service.md similarity index 100% rename from _posts/10-02-01-Platform-as-a-Service.md rename to _posts/11-02-01-Platform-as-a-Service.md diff --git a/_posts/10-03-01-Virtual-or-Dedicated-Servers.md b/_posts/11-03-01-Virtual-or-Dedicated-Servers.md similarity index 100% rename from _posts/10-03-01-Virtual-or-Dedicated-Servers.md rename to _posts/11-03-01-Virtual-or-Dedicated-Servers.md diff --git a/_posts/10-04-01-Shared-Servers.md b/_posts/11-04-01-Shared-Servers.md similarity index 100% rename from _posts/10-04-01-Shared-Servers.md rename to _posts/11-04-01-Shared-Servers.md diff --git a/_posts/10-05-01-Building-your-Application.md b/_posts/11-05-01-Building-your-Application.md similarity index 100% rename from _posts/10-05-01-Building-your-Application.md rename to _posts/11-05-01-Building-your-Application.md diff --git a/_posts/11-01-01-Caching.md b/_posts/12-01-01-Caching.md similarity index 100% rename from _posts/11-01-01-Caching.md rename to _posts/12-01-01-Caching.md diff --git a/_posts/11-02-01-Bytecode-Cache.md b/_posts/12-02-01-Bytecode-Cache.md similarity index 100% rename from _posts/11-02-01-Bytecode-Cache.md rename to _posts/12-02-01-Bytecode-Cache.md diff --git a/_posts/11-03-01-Object-Caching.md b/_posts/12-03-01-Object-Caching.md similarity index 100% rename from _posts/11-03-01-Object-Caching.md rename to _posts/12-03-01-Object-Caching.md diff --git a/_posts/12-01-01-Resources.md b/_posts/13-01-01-Resources.md similarity index 100% rename from _posts/12-01-01-Resources.md rename to _posts/13-01-01-Resources.md diff --git a/_posts/12-02-01-Frameworks.md b/_posts/13-02-01-Frameworks.md similarity index 100% rename from _posts/12-02-01-Frameworks.md rename to _posts/13-02-01-Frameworks.md diff --git a/_posts/12-03-01-Components.md b/_posts/13-03-01-Components.md similarity index 100% rename from _posts/12-03-01-Components.md rename to _posts/13-03-01-Components.md diff --git a/_posts/13-01-01-Community.md b/_posts/14-01-01-Community.md similarity index 100% rename from _posts/13-01-01-Community.md rename to _posts/14-01-01-Community.md From 009ce6b18b19f1c48c82249401a49beb234c877b Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Tue, 26 Nov 2013 14:37:09 +0000 Subject: [PATCH 38/60] Missed a rename --- _posts/{08-01-01-Databases.md => 07-01-01-Databases.md} | 0 ...Errors-and-Exceptions.md => 08-01-01-Errors-and-Exceptions.md} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename _posts/{08-01-01-Databases.md => 07-01-01-Databases.md} (100%) rename _posts/{07-01-01-Errors-and-Exceptions.md => 08-01-01-Errors-and-Exceptions.md} (100%) diff --git a/_posts/08-01-01-Databases.md b/_posts/07-01-01-Databases.md similarity index 100% rename from _posts/08-01-01-Databases.md rename to _posts/07-01-01-Databases.md diff --git a/_posts/07-01-01-Errors-and-Exceptions.md b/_posts/08-01-01-Errors-and-Exceptions.md similarity index 100% rename from _posts/07-01-01-Errors-and-Exceptions.md rename to _posts/08-01-01-Errors-and-Exceptions.md From 5e0f12004c5d962b17cd9b30fef01d80a46a96b5 Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Thu, 28 Nov 2013 12:17:44 +0000 Subject: [PATCH 39/60] First draft - Resolves #280 --- _posts/06-01-01-Dependency-Injection.md | 8 ++++ _posts/06-02-01-Basic-Concept.md | 57 +++++++++++++++++++++++++ _posts/06-03-01-Complex-Problem.md | 49 +++++++++++++++++++++ _posts/06-04-01-Containers.md | 14 ++++++ _posts/06-05-01-Further-Reading.md | 11 +++++ 5 files changed, 139 insertions(+) create mode 100644 _posts/06-01-01-Dependency-Injection.md create mode 100644 _posts/06-02-01-Basic-Concept.md create mode 100644 _posts/06-03-01-Complex-Problem.md create mode 100644 _posts/06-04-01-Containers.md create mode 100644 _posts/06-05-01-Further-Reading.md diff --git a/_posts/06-01-01-Dependency-Injection.md b/_posts/06-01-01-Dependency-Injection.md new file mode 100644 index 0000000..3bac06e --- /dev/null +++ b/_posts/06-01-01-Dependency-Injection.md @@ -0,0 +1,8 @@ +--- +title: Dependency Injection +--- + +# Dependency Injection {#dependency_injection_title} + +Dependency Injection is a basic concept that solves a complex problem. As a software design pattern it is being adopted in +some way or another by all major PHP projects. diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md new file mode 100644 index 0000000..1748afe --- /dev/null +++ b/_posts/06-02-01-Basic-Concept.md @@ -0,0 +1,57 @@ +--- +isChild: true +--- + +## Basic Concept {#basic_concept_title} + +From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): + +> 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 component +with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. + +We can demonstrate the concept with a simple, yet naive, example. + +{% highlight php %} +adapter = new MySqlAdapter; + } +} + +class MysqlAdapter {} +{% endhighlight %} + +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This code can be refactored to use Dependency Injection +and therefore loosen the dependency. + +{% highlight php %} +adapter = $adapter; + } +} + +class MysqlAdapter {} +{% endhighlight %} + +Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could +set it directly. diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md new file mode 100644 index 0000000..07050d2 --- /dev/null +++ b/_posts/06-03-01-Complex-Problem.md @@ -0,0 +1,49 @@ +--- +isChild: true +--- + +## Complex Problem {#complex_problem_title} + +If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. +These are the complex problems that Dependency Injection solves, or to be more precise, elegantly solves. + +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 that other +controllers must extend to gain access to it's 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. + +Dependency Inversion Principle is the "D" in the S.O.L.I.D 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. + +{% highlight php %} +adapter = $adapter; + } +} + +interface AdapterInterface {} + +class MysqlAdapter implements AdapterInterface {} +{% endhighlight %} + +There are several benefits to the Database class now depending on an interface rather than a concretion. + +Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have +to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency +is an interface/contract we can happily mock that interface knowing that our colleague will build the adapter based on that contract. + +An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we +want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, +no more refactoring would be required as we can ensure that the adapter follows the contract set by the interface. diff --git a/_posts/06-04-01-Containers.md b/_posts/06-04-01-Containers.md new file mode 100644 index 0000000..b3eca74 --- /dev/null +++ b/_posts/06-04-01-Containers.md @@ -0,0 +1,14 @@ +--- +isChild: true +--- + +## Containers {#containers_title} + +The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency +Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often +are misused to implement an anti pattern, Service Location. Using a container as a Service Locator within your classes arguably +creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent +and ultimately harder to test. + +Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. +What this means in practice is that you can write application code that is as clean and de-coupled as the framework it is built on. diff --git a/_posts/06-05-01-Further-Reading.md b/_posts/06-05-01-Further-Reading.md new file mode 100644 index 0000000..e1d3645 --- /dev/null +++ b/_posts/06-05-01-Further-Reading.md @@ -0,0 +1,11 @@ +--- +isChild: true +--- + +## Further Reading {#further_reading_title} + +- [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](http://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://www.happyaccidents.me/dependency-injection-as-a-tool-for-testing/) From aaebe65095c2f17726dc086e8d108642eac5aefd Mon Sep 17 00:00:00 2001 From: happyaccidents Date: Thu, 28 Nov 2013 14:00:56 +0000 Subject: [PATCH 40/60] Revisions --- _posts/06-01-01-Dependency-Injection.md | 9 +++++++-- _posts/06-02-01-Basic-Concept.md | 16 +++++----------- _posts/06-03-01-Complex-Problem.md | 9 ++++++++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/_posts/06-01-01-Dependency-Injection.md b/_posts/06-01-01-Dependency-Injection.md index 3bac06e..e69c4a2 100644 --- a/_posts/06-01-01-Dependency-Injection.md +++ b/_posts/06-01-01-Dependency-Injection.md @@ -4,5 +4,10 @@ title: Dependency Injection # Dependency Injection {#dependency_injection_title} -Dependency Injection is a basic concept that solves a complex problem. As a software design pattern it is being adopted in -some way or another by all major PHP projects. +From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): + +> 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 component +with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 1748afe..520415b 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -4,15 +4,11 @@ isChild: true ## Basic Concept {#basic_concept_title} -From [Wikipedia](http://en.wikipedia.org/wiki/Dependency_injection): +We can demonstrate the concept with a simple, yet naive. -> 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 component -with it's dependencies either through constructor injection, method calls or the setting of properties. It is that simple. - -We can demonstrate the concept with a simple, yet naive, example. +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is +very tightly coupled to the adapter. {% highlight php %} Date: Fri, 29 Nov 2013 09:46:15 +0000 Subject: [PATCH 41/60] Typos and further change re comments --- _posts/06-03-01-Complex-Problem.md | 26 +++++++++++++------------- _posts/06-04-01-Containers.md | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/_posts/06-03-01-Complex-Problem.md b/_posts/06-03-01-Complex-Problem.md index 69e69fb..9fd0f21 100644 --- a/_posts/06-03-01-Complex-Problem.md +++ b/_posts/06-03-01-Complex-Problem.md @@ -4,26 +4,26 @@ isChild: true ## Complex Problem {#complex_problem_title} -If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. +If you have ever read about Dependency Injection then you have probably seen the terms *"Inversion of Control"* or *"Dependency Inversion Principle"*. These are the complex problems that Dependency Injection solves. ### Inversion of Control -Inversion of Control is as it says, "inverting the control" of a system by keeping organisational control entirely separate from our objects. +Inversion of Control is as it says, "inverting the control" of a system by keeping organisational 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. -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 that other -controllers must extend to gain access to it's dependencies. This **is** Inversion of Control, however, instead of loosening +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 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, +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 -Dependency Inversion Principle is the "D" in the S.O.L.I.D 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 +Dependency Inversion Principle is the "D" in the S.O.L.I.D 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. {% highlight php %} @@ -45,12 +45,12 @@ interface AdapterInterface {} class MysqlAdapter implements AdapterInterface {} {% endhighlight %} -There are several benefits to the Database class now depending on an interface rather than a concretion. +There are several benefits to the `Database` class now depending on an interface rather than a concretion. -Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have -to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency +Consider that you are working in a team and the adapter is being worked on by a colleague. In our first example, we would have +to wait for said colleague to finish the adapter before we could properly mock it for our unit tests. Now that the dependency is an interface/contract we can happily mock that interface knowing that our colleague will build the adapter based on that contract. -An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we -want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, +An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide that we +want to migrate to a different type of database, we can write an adapter that implements the original interface and inject that instead, no more refactoring would be required as we can ensure that the adapter follows the contract set by the interface. diff --git a/_posts/06-04-01-Containers.md b/_posts/06-04-01-Containers.md index b3eca74..f0e5466 100644 --- a/_posts/06-04-01-Containers.md +++ b/_posts/06-04-01-Containers.md @@ -4,11 +4,11 @@ isChild: true ## Containers {#containers_title} -The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency -Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often -are misused to implement an anti pattern, Service Location. Using a container as a Service Locator within your classes arguably -creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent +The first thing you should understand about Dependency Injection Containers is that they are not the same thing as Dependency +Injection. A container is a convenience utility that helps us implement Dependency Injection, however, they can be and often +are misused to implement an anti-pattern, Service Location. Injecting a DI container as a Service Locator in to your classes arguably +creates a harder dependency on the container than the dependency you are replacing. It also makes your code much less transparent and ultimately harder to test. -Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. +Most modern frameworks have their own Dependency Injection Container that allows you to wire your dependencies together through configuration. What this means in practice is that you can write application code that is as clean and de-coupled as the framework it is built on. From 3cb8aea787549ca68d231b19ac2fec7bf78dae73 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 29 Nov 2013 11:56:00 -0500 Subject: [PATCH 42/60] Fix DI typo --- _posts/06-02-01-Basic-Concept.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 520415b..727ba7a 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -4,10 +4,10 @@ isChild: true ## Basic Concept {#basic_concept_title} -We can demonstrate the concept with a simple, yet naive. +We can demonstrate the concept with a simple, yet naive example. -Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the -adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is +Here we have a `Database` class that requires an adapter to speak to the database. We instantiate the +adapter in the constructor and create a hard dependency. This makes testing difficult and means the `Database` class is very tightly coupled to the adapter. {% highlight php %} @@ -46,6 +46,6 @@ class Database class MysqlAdapter {} {% endhighlight %} -Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method -that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could +Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could set it directly. From cd130fcb20f6aae8d1b5e31dfabe475d8c3433f9 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 29 Nov 2013 11:57:23 -0500 Subject: [PATCH 43/60] Fix DI typo --- _posts/06-02-01-Basic-Concept.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/06-02-01-Basic-Concept.md b/_posts/06-02-01-Basic-Concept.md index 727ba7a..fb9954b 100644 --- a/_posts/06-02-01-Basic-Concept.md +++ b/_posts/06-02-01-Basic-Concept.md @@ -46,6 +46,6 @@ class Database class MysqlAdapter {} {% endhighlight %} -Now we are giving the `Database` class it's dependency rather than it creating it itself. We could even create a method +Now we are giving the `Database` class its dependency rather than it creating it itself. We could even create a method that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we could set it directly. From 0cc17ac2e19900d0292b0a6cae6129b8e9221ae5 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 2 Dec 2013 10:23:11 -0500 Subject: [PATCH 44/60] Fixed link for Enhance PHP Thanks to @w00 for pointing this one out in #332. --- _posts/10-02-01-Test-Driven-Development.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_posts/10-02-01-Test-Driven-Development.md b/_posts/10-02-01-Test-Driven-Development.md index f6571d4..71528d6 100644 --- a/_posts/10-02-01-Test-Driven-Development.md +++ b/_posts/10-02-01-Test-Driven-Development.md @@ -30,10 +30,11 @@ you run a project which accepts pull requests then you should suggest this as a [PHPUnit](http://phpunit.de) is the de-facto testing framework for writing unit tests for PHP applications, but there are several alternatives -* [SimpleTest](http://simpletest.org) -* [Enhance PHP](http://www.enhance-php.com/) -* [PUnit](http://punit.smf.me.uk/) * [atoum](https://github.com/atoum/atoum) +* [Enhance PHP](https://github.com/Enhance-PHP/Enhance-PHP) +* [PUnit](http://punit.smf.me.uk/) +* [SimpleTest](http://simpletest.org) + ### Integration Testing From 36135d613e1149530e400f6ec352ad48e8e49d08 Mon Sep 17 00:00:00 2001 From: Ryan Koven Date: Tue, 3 Dec 2013 13:45:16 -0800 Subject: [PATCH 45/60] Remove an extraneous 'to'; rectify an instance of an incorrect verb tense; small adjust to punctuation. Original text noted that it's "usually a good idea to follow to common patterns". Removed extra 'to'. In MVC section the sentence "The model-view-controller (MVC) pattern... let..." should be changed to "The model-view-controller (MVC) pattern...lets..." Also added a semicolon to a sentence in the Factory section that Strunk and White would agree enhances the clarity of the sentence. --- pages/Design-Patterns.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 4a3fe45..64618c2 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -6,7 +6,7 @@ title: Design Patterns # Design Patterns There are numerous ways to structure the code and project for you web application, and you can put as much or as little -thought as you like into architecting. But it is usually a good idea to follow to common patterns because it will make +thought as you like into architecting. But it is usually a good idea to follow common patterns because it will make your code easier to manage and easier for others to understand. * [Architectural pattern on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern) @@ -51,7 +51,7 @@ print_r($veyron->get_make_and_model()); // outputs "Bugatti Veyron" {% endhighlight %} This code uses a factory to create the Automobile object. There are two possible benefits to building your code this -way, the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you +way; the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you will only have to modify the code in the factory, instead of every place in your project that uses the Automobile class. The second possible benefit is that if creating the object is a complicated job you can do all of the work in the factory, instead of repeating it every time you want to create a new instance. @@ -250,11 +250,7 @@ and gives you a central place to hook in code that should be run for every reque ## Model-View-Controller -The model-view-controller (MVC) pattern and its relatives HMVC and MVVM let you break up code into logical objects that -serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable -throughout your application. Controllers handle the request, process the data returned from models and load views to -send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web -browser. +The model-view-controller (MVC) pattern and its relatives HMVC and MVVM lets you break up code into logical objects that serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable throughout your application. Controllers handle the request, process the data returned from models and load views to send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web browser. MVC is the most common architectural pattern used in the popular [PHP frameworks](https://github.com/codeguy/php-the-right-way/wiki/Frameworks). From b41eeca6dad3b53dddbb06ec3df9552c5c7f969d Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 7 Dec 2013 09:26:04 -0500 Subject: [PATCH 46/60] Updated mwop's Twitter account --- _posts/13-01-01-Resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-01-01-Resources.md b/_posts/13-01-01-Resources.md index 3837fbc..9466aa5 100644 --- a/_posts/13-01-01-Resources.md +++ b/_posts/13-01-01-Resources.md @@ -12,7 +12,7 @@ * [Derick Rethans](http://twitter.com/derickr) * [Chris Shiflett](http://twitter.com/shiflett) * [Sebastian Bergmann](http://twitter.com/s_bergmann) -* [Matthew Weier O'Phinney](http://twitter.com/weierophinney) +* [Matthew Weier O'Phinney](http://twitter.com/mwop) * [Pádraic Brady](http://twitter.com/padraicb) * [Anthony Ferrara](http://twitter.com/ircmaxell) * [Nikita Popov](http://twitter.com/nikita_ppv) From ff25a697d4350db5270d1894695f6b5714ba617a Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 8 Dec 2013 16:02:22 +0100 Subject: [PATCH 47/60] coding style fix --- _posts/07-01-01-Databases.md | 2 +- _posts/09-03-01-Password-Hashing.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 5f024fa..7f37417 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -45,7 +45,7 @@ which will delete all of your users! Instead, you should sanitize the ID input u prepare('SELECT name FROM users WHERE id = :id'); -$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatically sanitized by PDO +$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); // <-- Automatically sanitized by PDO $stmt->execute(); {% endhighlight %} diff --git a/_posts/09-03-01-Password-Hashing.md b/_posts/09-03-01-Password-Hashing.md index cf9f544..ad82acd 100644 --- a/_posts/09-03-01-Password-Hashing.md +++ b/_posts/09-03-01-Password-Hashing.md @@ -22,9 +22,9 @@ require 'password.php'; $passwordHash = password_hash('secret-password', PASSWORD_DEFAULT); if (password_verify('bad-password', $passwordHash)) { - //Correct Password + // Correct Password } else { - //Wrong password + // Wrong password } {% endhighlight %} From 7e2b75d83a842d569ce9aa82bdd113ddfd529f2d Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Fri, 13 Dec 2013 12:10:23 -0500 Subject: [PATCH 48/60] Update GA snippet --- _layouts/default.html | 2 +- _layouts/page.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index aeb97c5..863dfa8 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -23,7 +23,7 @@ _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); diff --git a/_layouts/page.html b/_layouts/page.html index a3556b9..9c22aab 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -22,7 +22,7 @@ _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); From da53e99c4d0cb85c15e1f15c2e46cca26cf7a195 Mon Sep 17 00:00:00 2001 From: "Syed I.R" Date: Sun, 2 Feb 2014 20:16:04 +0530 Subject: [PATCH 49/60] Include Protobox Another online GUI service for Vagrant. It has some nice features like web apps and various other configs. [More info](http://getprotobox.com/) --- _posts/01-06-01-Vagrant.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_posts/01-06-01-Vagrant.md b/_posts/01-06-01-Vagrant.md index c3768a5..4d64f1f 100644 --- a/_posts/01-06-01-Vagrant.md +++ b/_posts/01-06-01-Vagrant.md @@ -21,15 +21,17 @@ create and edit your files on your host machine and then run the code inside you ### A little help -If you need a little help to start using Vagrant there are two services that might be useful: +If you need a little help to start using Vagrant there are three services that might be useful: - [Rove][rove]: service that allows you to pregenerate typical Vagrant builds, PHP among the options. The provisioning is made with Chef. - [Puphpet][puphpet]: simple GUI to set up virtual machines for PHP development. **Heavily focused in PHP**. Besides local VMs, can be used to deploy to cloud services as well. The provisioning is made with Puppet. +- [Protobox][protobox]: is a layer on top of vagrant and a web GUI to setup virtual machines for web development. A single YAML document controls everything that is installed on the virtual machine. [vagrant]: http://vagrantup.com/ [puppet]: http://www.puppetlabs.com/ [chef]: http://www.opscode.com/ [rove]: http://rove.io/ [puphpet]: https://puphpet.com/ +[protobox]: http://getprotobox.com/ From 64093a185fb0118b82752095a970dd9d441a38d2 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Mon, 3 Feb 2014 23:24:21 -0500 Subject: [PATCH 50/60] Add missing translation links --- _includes/welcome.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 8e73e69..3638d5d 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -1,19 +1,19 @@ # Welcome -There's a lot of outdated information on the Web that leads new PHP users astray, -propagating bad practices and insecure code. _PHP: The Right Way_ is an easy-to-read, -quick reference for PHP popular coding standards, links to authoritative tutorials -around the Web and what the contributors consider to be best practices at the present +There's a lot of outdated information on the Web that leads new PHP users astray, +propagating bad practices and insecure code. _PHP: The Right Way_ is an easy-to-read, +quick reference for PHP popular coding standards, links to authoritative tutorials +around the Web and what the contributors consider to be best practices at the present time. -_There is no canonical way to use PHP_. This website aims to introduce new PHP -developers to some topics which they may not discover until it is too late, and aims -to give seasoned pros some fresh ideas on those topics they've been doing for years -without ever reconsidering. This website will also not tell you which tools to use, but -instead offer suggestions for multiple options, when possible explaining the differences -in approach and use-case. +_There is no canonical way to use PHP_. This website aims to introduce new PHP +developers to some topics which they may not discover until it is too late, and aims +to give seasoned pros some fresh ideas on those topics they've been doing for years +without ever reconsidering. This website will also not tell you which tools to use, but +instead offer suggestions for multiple options, when possible explaining the differences +in approach and use-case. -This is a living document and will continue to be updated with more helpful information +This is a living document and will continue to be updated with more helpful information and examples as they become available. ## Translations @@ -25,11 +25,11 @@ _PHP: The Right Way_ is (or soon will be) translated into many different languag * [Chinese](http://wulijun.github.com/php-the-right-way) * [Japanese](http://ja.phptherightway.com) * [Korean](http://wafe.github.io/php-the-right-way/) -* Italian (Link broken... we're looking into it) +* Italian (http://it.phptherightway.com/) * [Polish](http://pl.phptherightway.com/) * [Portuguese](http://br.phptherightway.com/) * [Russian](http://getjump.github.io/ru-php-the-right-way) -* Spanish (Link broken... we're looking into it) +* Spanish (lamaneracorrecta.php.org.ve) * [Ukrainian](http://iflista.github.com/php-the-right-way/) * [Bulgarian](http://bg.phptherightway.com/) * [German](http://rwetzlmayr.github.io/php-the-right-way/) From 936798c1669f544809966c893c2370fefea7df92 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Mon, 3 Feb 2014 23:26:02 -0500 Subject: [PATCH 51/60] Fix translation link formatting --- _includes/welcome.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 3638d5d..871e15a 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -25,11 +25,11 @@ _PHP: The Right Way_ is (or soon will be) translated into many different languag * [Chinese](http://wulijun.github.com/php-the-right-way) * [Japanese](http://ja.phptherightway.com) * [Korean](http://wafe.github.io/php-the-right-way/) -* Italian (http://it.phptherightway.com/) +* [Italian](http://it.phptherightway.com/) * [Polish](http://pl.phptherightway.com/) * [Portuguese](http://br.phptherightway.com/) * [Russian](http://getjump.github.io/ru-php-the-right-way) -* Spanish (lamaneracorrecta.php.org.ve) +* [Spanish](lamaneracorrecta.php.org.ve) * [Ukrainian](http://iflista.github.com/php-the-right-way/) * [Bulgarian](http://bg.phptherightway.com/) * [German](http://rwetzlmayr.github.io/php-the-right-way/) From 1736a6257882720691b7e042d75f7aa61782db9a Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Mon, 3 Feb 2014 23:26:39 -0500 Subject: [PATCH 52/60] Fix translation link formatting --- _includes/welcome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 871e15a..8995852 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -29,7 +29,7 @@ _PHP: The Right Way_ is (or soon will be) translated into many different languag * [Polish](http://pl.phptherightway.com/) * [Portuguese](http://br.phptherightway.com/) * [Russian](http://getjump.github.io/ru-php-the-right-way) -* [Spanish](lamaneracorrecta.php.org.ve) +* [Spanish](http://lamaneracorrecta.php.org.ve) * [Ukrainian](http://iflista.github.com/php-the-right-way/) * [Bulgarian](http://bg.phptherightway.com/) * [German](http://rwetzlmayr.github.io/php-the-right-way/) From 6f490b5af5c46ab97235577ac04a9f02854219db Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Sun, 9 Feb 2014 11:11:39 -0500 Subject: [PATCH 53/60] Clarify Chinese translation as simplfied Chinese --- _includes/welcome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 8995852..8860c3c 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -22,7 +22,7 @@ _PHP: The Right Way_ is (or soon will be) translated into many different languag * [English](http://www.phptherightway.com) * Catalan (Link broken... we're looking into it) -* [Chinese](http://wulijun.github.com/php-the-right-way) +* [Chinese (Simplified)](http://wulijun.github.com/php-the-right-way) * [Japanese](http://ja.phptherightway.com) * [Korean](http://wafe.github.io/php-the-right-way/) * [Italian](http://it.phptherightway.com/) From ee69c60ed04009ec4aa6d05165a1b5324fe1a28b Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Sun, 9 Feb 2014 11:13:07 -0500 Subject: [PATCH 54/60] Remove link to Catalan translation --- _includes/welcome.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_includes/welcome.md b/_includes/welcome.md index 8860c3c..2e759ae 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -21,7 +21,6 @@ and examples as they become available. _PHP: The Right Way_ is (or soon will be) translated into many different languages: * [English](http://www.phptherightway.com) -* Catalan (Link broken... we're looking into it) * [Chinese (Simplified)](http://wulijun.github.com/php-the-right-way) * [Japanese](http://ja.phptherightway.com) * [Korean](http://wafe.github.io/php-the-right-way/) From 84851c9b5dd03fd2dcd9d0b164e68c203d5521c5 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 11 Feb 2014 17:45:00 -0500 Subject: [PATCH 55/60] Removed Illuminate from components listing While they are technically available as separate components, the level of coupling is so incredibly high that one is not usually usable without multiple others - with the only exception here being illuminate\database. Until the others are packaged up in a way that makes them usable, with documentation on how to use them solo of Laravel, then these cannot realistically be considered as reusable components, regardless of anyones wishful thinking (my own included). --- _posts/13-03-01-Components.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index e29a3ca..2128d8b 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -21,6 +21,5 @@ just another repository for reusable components: [fuelval]: https://github.com/fuelphp/validation * [Aura](http://auraphp.github.com/) -* [FuelPHP (2.0 only)](https://github.com/fuelphp) -* [Laravel's "Illuminate Components"](https://github.com/illuminate) +* [FuelPHP](https://github.com/fuelphp) * [Symfony Components](http://symfony.com/doc/current/components/index.html) From 5870bf3981cd291ef905c099affc1eeb08a896ee Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 11 Feb 2014 17:46:47 -0500 Subject: [PATCH 56/60] Added The League of Extraordinary Packages This is a collection of framework agnostic packages, created by a network of developers (myself included). If anyone else knows of more component vendors then please get in touch. --- _posts/13-03-01-Components.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index 2128d8b..cb811ea 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -23,3 +23,4 @@ just another repository for reusable components: * [Aura](http://auraphp.github.com/) * [FuelPHP](https://github.com/fuelphp) * [Symfony Components](http://symfony.com/doc/current/components/index.html) +* [The League of Extraordinary Packages](http://thephpleague.com/) From 7cd1a5345ec836a63a2e4a2e6054347b3ba388fa Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Thu, 13 Feb 2014 19:50:53 -0500 Subject: [PATCH 57/60] Re-add Laravel Illuminate to component list --- _posts/13-03-01-Components.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index cb811ea..607b740 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -4,17 +4,17 @@ isChild: true ## Components {#components_title} -As mentioned above "Components" are another approach to the common goal of creating, distributing and implementing shared code. Various +As mentioned above "Components" are another approach to the common goal of creating, distributing and implementing shared code. Various component repositories exist, the main two of which are: * [Packagist](/#composer_and_packagist) * [PEAR](/#pear) -Both of these repositories have command line tools associated with them to help the installation and upgrade processes, and have been +Both of these repositories have command line tools associated with them to help the installation and upgrade processes, and have been explained in more detail in the [Dependency Management][dm] section. -There are also component-based frameworks, which allow you to use their components with minimal (or no) requirements. For example, you -can use the [FuelPHP Validation package][fuelval], without needing to use the FuelPHP framework itself. These projects are essentially +There are also component-based frameworks, which allow you to use their components with minimal (or no) requirements. For example, you +can use the [FuelPHP Validation package][fuelval], without needing to use the FuelPHP framework itself. These projects are essentially just another repository for reusable components: [dm]: /#dependency_management @@ -22,5 +22,6 @@ just another repository for reusable components: * [Aura](http://auraphp.github.com/) * [FuelPHP](https://github.com/fuelphp) +* [Laravel's "Illuminate Components"](https://github.com/illuminate) * [Symfony Components](http://symfony.com/doc/current/components/index.html) * [The League of Extraordinary Packages](http://thephpleague.com/) From 355ee80ee25161e50ee0526d380ae1f58c842758 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Thu, 13 Feb 2014 20:08:28 -0500 Subject: [PATCH 58/60] Change Laravel component link to point directly to Laravel ORM as suggested by Taylor Otwell Other Laravel components, like Queue, will be refactored and componetized soon --- _posts/13-03-01-Components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index 607b740..94f4f62 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -22,6 +22,6 @@ just another repository for reusable components: * [Aura](http://auraphp.github.com/) * [FuelPHP](https://github.com/fuelphp) -* [Laravel's "Illuminate Components"](https://github.com/illuminate) +* [Laravel's Eloquent ORM](https://github.com/illuminate/database) * [Symfony Components](http://symfony.com/doc/current/components/index.html) * [The League of Extraordinary Packages](http://thephpleague.com/) From 20a1b136b8d766856011cf80c9c06d7cd8002612 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Thu, 13 Feb 2014 20:16:40 -0500 Subject: [PATCH 59/60] Clarify the Laravel Illuminate components with a message beneath the list of component libraries --- _posts/13-03-01-Components.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index 94f4f62..1bfbe8f 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -22,6 +22,9 @@ just another repository for reusable components: * [Aura](http://auraphp.github.com/) * [FuelPHP](https://github.com/fuelphp) -* [Laravel's Eloquent ORM](https://github.com/illuminate/database) * [Symfony Components](http://symfony.com/doc/current/components/index.html) * [The League of Extraordinary Packages](http://thephpleague.com/) +* [Laravel's Eloquent ORM](https://github.com/illuminate/database) + +_Laravel's [Illuminate components](https://github.com/illuminate) will eventually become better decoupled from the Laravel framework. +For now, only the Laravel Eloquent ORM component is listed._ From f619846780e3113557051b7f600c11923cc2be97 Mon Sep 17 00:00:00 2001 From: Josh Lockhart Date: Sat, 15 Feb 2014 09:47:06 -0500 Subject: [PATCH 60/60] Add Laravel Illuminate Queue component to component list --- _posts/13-03-01-Components.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_posts/13-03-01-Components.md b/_posts/13-03-01-Components.md index 1bfbe8f..0a39967 100644 --- a/_posts/13-03-01-Components.md +++ b/_posts/13-03-01-Components.md @@ -24,7 +24,9 @@ just another repository for reusable components: * [FuelPHP](https://github.com/fuelphp) * [Symfony Components](http://symfony.com/doc/current/components/index.html) * [The League of Extraordinary Packages](http://thephpleague.com/) -* [Laravel's Eloquent ORM](https://github.com/illuminate/database) +* Laravel's Illuminate Components + * [Eloquent ORM](https://github.com/illuminate/database) + * [Queue](https://github.com/illuminate/queue) -_Laravel's [Illuminate components](https://github.com/illuminate) will eventually become better decoupled from the Laravel framework. -For now, only the Laravel Eloquent ORM component is listed._ +_Laravel's [Illuminate components](https://github.com/illuminate) will become better decoupled from the Laravel framework. +For now, only the components best decoupled from the Laravel framework are listed above._