Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Adding a Subdomain to Your Laravel Application
Nov 16, 2018 @ 11:44:42

On the Pineco.de blog there's a tutorial for the Laravel users out there showing how to set up subdomains in your application using the built-in framework functionality (and their setup with Valet/Forge).

Often we need to handle subdomains with our Laravel application. Let’s take a look, how can we treat the routes dynamically and set up the subdomain with Valet and Forge.

The tutorial then walks you through the steps to get subdomains working:

  • Defining Subdomains in Our Routes
  • Dynamically Generate Subdomains
  • Faking Subdomains in Valet
  • Setting Up Subdomains in Forge

Each section comes with a brief explanation and any code or configuration changes that would need to be made to make it all work.

tagged: subdomain laravel tutorial route dynamic valet forge

Link: https://pineco.de/adding-a-subdomain-to-your-laravel-application/

CloudWays Blog:
PHP-FPM Cuts Web App Loading Times by 300%
Nov 16, 2018 @ 10:18:33

There's several ways to run PHP on various webservers out there and in a tutorial from the CloudWays blog they focus on one: using PHP-FPM and the performance gain it can give.

Speed matters. Our engineers are always looking at ways on improving the stack. One of the major objectives of our stack integrations is to improve the speed of the overall processes of our stack.

Keeping up with this practice, in a bid to increase speed of aspects of Managed Cloud Hosting coupled with constant improvements based on users feedback, Cloudways has now integrated PHP-FPM in all its servers. Owing to this integration, applications hosted on Cloudways servers are now going to perform up to 3x faster.

The post starts with a look at why to choose PHP-FPM and shares some benchmarks of it in use versus the more typical mod_php shared module. It then gets into the implementation steps, linking to a step-by-step guide on how to implement it.

tagged: phpfpm performance tutorial installation benchmark

Link: https://www.cloudways.com/blog/php-fpm-on-cloud/

Sameer Nyaupane:
PHP Test Driven Development Part 5: Integration Testing
Nov 15, 2018 @ 13:54:21

Sameer Nyaupane has posted the latest part in his "PHP Test Driven Development" series of tutorials. In this latest post, part five, he focuses on integration testing, ensuring the components are all working together as they should.

Let’s learn about Integration testing today. Integration testing is a method of testing by passing in the real dependencies and thus testing out the integration between two or more objects.

He updates the examples from his previous post to test the integration between the Math and Calculate classes. He walks you through the changes required to the phpunit.xml configuration and the creation of the initial test classes. He goes through each line of the tests, explaining what it's doing and how mocks are used to help with dependencies.

tagged: tutorial testdrivendevelopment tdd part5 series integration testing

Link: https://medium.com/@sameernyaupane/php-test-driven-development-part-5-integration-testing-51535ca56bf0

PHPUgly Podcast:
Episode #128 - The Set Up
Nov 15, 2018 @ 11:19:32

The PHPUgly podcast, hosted by PHP community members Eric Van Johnson, John Congdon and Thomas Rideout, has posted their latest episode - Episode #128: The Set Up.

In this latest show, the hosts discuss several topics including the preloading RFC, Laravel Telescope and the post from Freek Van der Herten about other people's setups.

You can listen to this latest show either using the in-page audio player or by downloading the mp3 directly for listening at your leisure. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get updates when the latest shows are released. You can also support them via Patreon to help make the show even better!

tagged: phpugly podcast ep128 setup community

Link: http://www.phpugly.com/128

Write to Files and Read Files With PHP
Nov 15, 2018 @ 10:41:04

TutsPlus.com has continued their series of posts covering some of the basics of the PHP language with their latest article. In this newest tutorial they cover reading from and writing to files using functionality already included with the language.

In this tutorial, you'll learn several important functions in PHP which are sufficient for all your basic file reading and writing needs. You'll learn how to read a file, write to a file, write to a text file, and check if a file exists.

Luckily, PHP provides a lot of functions to read and write data to files. In this tutorial, I'll show you the easiest ways to read data from a local or remote file and how to use flags to write to files exactly how we want.

The tutorial is broken down into several sections:

  • checking if a file exists
  • reading data from a file
  • writing data to a file
  • reading and writing data to files

Each section comes with a bit of description and code examples showing it in action. The post wraps up with some final thoughts and "gotchas" that you need to know when working with files in PHP (especially large ones).

tagged: tutorial introduction file read write beginner

Link: https://code.tutsplus.com/tutorials/reading-and-writing-data-to-files-in-php--cms-32117

Larry Garfield:
Book review - Functional Programming in PHP
Nov 15, 2018 @ 09:28:47

Larry Garfield has posted a book review to his Steemit site giving his thoughts about the "Functional Programming in PHP" book from php[architect] press.

I was asked by php[architect] a while back to review "Functional Programming in PHP, 2nd Ed" by Simon Holywell. I've been sitting on this review for a while, so it's time to finally get it done.

He starts with some of the usual disclosures about receiving the book (for free), what the review is based on and that the opinions are his alone. He goes on to share some of his initial impressions of the book and whether he feels it's a good book to recommend to those wanting to start out with functional programming in PHP. He also points out that, while the book was published in 2016 the recommended PHP version even then was quite old (v5.4). He covers some of the topics that the book covers, noting that many of them, while interesting, don't add much to the overall book.

He does focus on one chapter and how, at the beginning, it showed promise but quickly moved towards using 3rd party libraries for more complex operations. He finishes the review by answering the question: "does this book make me care about functional programming in PHP?"

tagged: bookreview functional programming tutorial phparchitect

Link: https://steemit.com/php/@crell/book-review-functional-programming-in-php

Community News:
Recent posts from PHP Quickfix (11.14.2018)
Nov 14, 2018 @ 08:05:01

Recent posts from the PHP Quickfix site:



Community News:
Latest PECL Releases (11.13.2018)
Nov 13, 2018 @ 08:05:02

Latest PECL Releases:

  • psr 0.6.1
    - Fixed test failures on PHP 5.6

  • yaml 2.0.3
    Bugs Fixed: - #75029 Empty documents are valid (bd808) - #75213 Fix float parsing on Alpine (neclimdul) - #76309 Quote strings like "0." when emitting (bd808) - #76522 PHP 7.3 compilation fixes (dktapps, remicollet) - CRLF and whitespace fixes (petk)
  • mustache 0.8.1
    - Require libmustache >= 0.5.0 - Remove old deprecated experimental compiler - Change minimum PHP version to 5.6 - Allow installation on PHP 7.3 - Fix missing php5to7.h (@remicollet)
  • handlebars 0.8.3
    - Allow installation on PHP 7.3 - Removed class aliases `HandlebarsRegistryRegistry` for `HandlebarsRegistry` and `HandlebarsRegistryDefaultRegistry` for `HandlebarsDefaultRegistry`
  • psr 0.6.0
    - Added PSR-18 support (@flyinghail) - Documentation/CI improvements (@sergeyklay) - Set minimum PHP version to 5.6
  • mustache 0.8.0
    - Require libmustache >= 0.5.0 - Remove old deprecated experimental compiler - Change minimum PHP version to 5.6 - Allow installation on PHP 7.3
  • swoole 4.2.7
    + `Server` adds `task_async` config item, supports switching between pure sync mode and async mode, sync mode by default (backward compatibility) + Support `gethostbyname` in `Runtime::enableCoroutine` + Support `PHP7.3RC5` version * Fixed low version `GCC` compatibility problem (#2094) * Fixed ssl timeout bug for `client->recv` * Fixed `Socks5` proxy not work (#2103) * Fixed the bug that `connected` property of `CoRedis` was not updated. (#2104) * Fixed `taskWait` segment fault (#2098) * Fixed `CoSocket` reuse problem * Fixed a bug in `ProcessPool` - `SwooleSerialize` will be forced to close in PHP73 (unsupported temporarily)
  • redis 4.2.0RC3
    phpredis 4.2.0RC3

    The main feature of this release is new Streams API implemented by Michael Grunder.


    • Optimize close method [2a1ef961] (fanjiapeng)
    • Prevent potential infinite loop for sessions [4e2de158] (Pavlo Yatsukhnenko)
    • Fix coverty warnings [6f7ddd27] (Pavlo Yatsukhnenko)
    • Fix session memory leaks [071a1d54, 92f14b14] (Pavlo Yatsukhnenko, Michael Grunder)
    • Fix XCLAIM on 32-bit installs [18dc2aac] (Michael Grunder)
    • Build warning fixes [b5093910, 51027044, 8b0f28cd] (Pavlo Yatsukhnenko, Remi Collet, twosee)


    • Fix incorrect arginfo for Redis::sRem and Redis::multi [25b043ce] (Pavlo Yatsukhnenko)
    • Update STREAM API to handle STATUS -> BULK reply change [0b97ec37] (Michael Grunder)
    • Treat a -1 response from cluster_check_response as a timeout. [27df9220, 07ef7f4e, d1172426] (Michael Grunder)
    • Use a ZSET insted of SET for EVAL tests [2e412373] (Michael Grunder)
    • Missing space between command and args [0af2a7fe] (@remicollet)


    • Streams API [2c9e0572] (Michael Grunder)
    • Reset the socket after a timeout to make sure no wrong data is received [cd6ebc6d] (@marcdejonge)
    • Modify session testing logic [bfd27471] (Michael Grunder)
    • Allow '-' and '+' arguments and add tests for zLexCount and zRemRangeByLex [d4a08697] (Michael Grunder)
    • Fix printf format warnings [dcde9331] (Pavlo Yatsukhnenko)
    • Session module is required [58bd8cc8] (@remicollet)
    • Set default values for ini entries [e206ce9c] (Pavlo Yatsukhnenko)
    • Display ini entries in output of phpinfo [908ac4b3] (Pavlo Yatsukhnenko)
    • Persistant connections can be closed via close method + change reconnection logic [1d997873] (Pavlo Yatsukhnenko)
    • Documentation improvements (@mg, @elcheco, @lucascourot, @nolimitdev, Michael Grunder)