12 Dec 2017

feedPlanet PHP

Faculty

Today, I am proud to introduce Faculty. We design, engineer, and build really great websites and apps. I love the web, and I feel fortunate to have been working on the web since its inception. From writing CGIs in C and laying out pages with tables, to ……

12 Dec 2017 7:00am GMT

11 Dec 2017

feedPlanet PHP

Symfony 4: Performance out of the Box

11 Dec 2017 12:00am GMT

10 Dec 2017

feedPlanet PHP

Whatsapp Chat from CLI Using Puppeteer

GoogleChrome puppeteer is interesting project to create browser automation tools, testing tools or web scrapping. I was wondering to use it for something useful and an idea popped in about creating CLI application that can be used to send and receive messages on Whatsapp. So I went on to creating Whatspup, a name based on both Whatsapp and puppeteer.

Features

Screenshot

Main Window


Head over to Whatspup repository and start using it :)

10 Dec 2017 11:06am GMT

05 Dec 2017

feedPlanet PHP

Avoid Dependency Injection

At least, avoid it when building DDD Aggregates: Dependency injection of a Repository or a Domain Service into an Aggregate should generally be viewed as harmful. The motivation may be to look up a dependent object instance from inside the Aggregate. The dependent object could be another Aggregate, or a number of them. … Preferably, … Continue reading Avoid Dependency Injection

05 Dec 2017 1:00pm GMT

Interview with Davey Shafik

dshafik Audio Show Notes Akamai ZendCon 2017

The post Interview with Davey Shafik appeared first on Voices of the ElePHPant.

05 Dec 2017 12:30pm GMT

30 Nov 2017

feedPlanet PHP

PHP 7.2.0 Released

The PHP development team announces the immediate availability of PHP 7.2.0. This release marks the second feature update to the PHP 7 series.PHP 7.2.0 comes with numerous improvements and new features such asConvert numeric keys in object/array castsCounting of non-countable objectsObject typehintHashContext as ObjectArgon2 in password hashImprove TLS constants to sane valuesMcrypt extension removedNew sodium extensionFor source downloads of PHP 7.2.0 please visit our downloads page Windows binaries can be found on the PHP for Windows site. The list of changes is recorded in the ChangeLog.The migration guide is available in the PHP Manual. Please consult it for the detailed list of new features and backward incompatible changes.Many thanks to all the contributors and supporters!

30 Nov 2017 12:00am GMT

29 Nov 2017

feedPlanet PHP

PHP-FPM tuning: Using ‘pm static’ for Max Performance

Let's take a very quick look at how best to set up PHP-FPM for high throughput, low latency, and a more stable use of CPU and memory. By default, most setups have PHP-FPM's PM (process manager) string set to dynamic and there's also the common advice to use ondemand if you suffer from available memory issues. However, let's compare the two management options based on php.net's documentation and also compare my favorite for high traffic setup --- static pm:

See the full list of global php-fpm.conf directives for further details.

PHP-FPM Process Manager (PM) Similarities to CPUFreq Governor

Now, this may seem a bit off topic, but I hope to tie it back into our PHP-FPM tuning topic. Okay, we've all had slow CPU issues at some point, whether it be a laptop, VM or dedicated server. Remember CPU frequency scaling? (CPUFreq governor.) These settings, available on both *nix and Windows, can improve the performance and system responsiveness by changing the CPU governor setting from ondemand to performance. This time, let's compare the descriptions and look for similarities:

See the full list of CPUFreq governor options for further details.

Notice the similarities? I wanted to use this comparison first, with the aim of finding the best way to write an article which recommends using pm static for PHP-FPM as your first choice.

With CPU governor, the performance setting is a pretty safe performance boost because it's almost entirely dependent on your server CPU's limit. The only other factors would be things such as heat, battery life (laptop) and other side effects of clocking your CPU frequency to 100% permanently. Once set to performance, it is indeed the fastest setting for your CPU. For example read about the 'force_turbo' setting on Raspberry Pi, which forces your RPi board to use the performance governor where performance improvement is more noticeable due to the low CPU clock speeds.

Using 'pm static' to Achieve Your Server's Max Performance

The PHP-FPM pm static setting depends heavily on how much free memory your server has. Basically, if you are suffering from low server memory, then pm ondemand or dynamic may be better options. On the other hand, if you have the memory available, you can avoid much of the PHP process manager (PM) overhead by setting pm static to the max capacity of your server. In other words, when you do the math, pm.static should be set to the max amount of PHP-FPM processes that can run without creating memory availability or cache pressure issues. Also, not so high as to overwhelm CPU(s) and have a pile of pending PHP-FPM operations.

Linux top php-fpm static pm

In the screenshot above, this server has pm = static and pm.max_children = 100 which uses a max of around 10GB of the 32GB installed. Take note of the self explanatory highlighted columns. During that screenshot there were about 200 'active users' (past 60 seconds) in Google Analytics. At that level, about 70% of PHP-FPM children are still idle. This means PHP-FPM is always set to the max capacity of your server's resources regardless of current traffic. Idle processes stay online, waiting for traffic spikes and responding immediately,

Truncated by Planet PHP, read more at the original (another 1392 bytes)

29 Nov 2017 5:00pm GMT

28 Nov 2017

feedPlanet PHP

23 Development Tools for Boosting Website Performance

When dealing with performance, it's hard to remember all the tools that might help you out during development. For that purpose, we've compiled a list of 23 performance tools for your reference. Some you'll have heard of, others probably not. Some have been covered in detail in our performance month, others are yet to be covered future articles; but all are very useful and should be part of your arsenal.

Client-side Performance Tools

1. Test your Mobile Speed with Google

Google's Test My Site is an online tool offered by Google and powered by the popular website performance tool WebPageTest.org.

Google’s Test My Site

You can either visualize your report on site or have it emailed to you via your email address.

Google’s Test My Site: Loading time

The tool gives you your website loading time (or Speed Index) calculated using a Chrome browser on a Moto G4 device within a 3G network. It also gives you the estimated percentage of visitors lost due to loading time. Among other things it also:

2. SiteSpeed.io

SiteSpeed.io is an open-source tool --- or a set of tools --- that can help you measure your website performance and improve it.

SiteSpeed.io

Image source: sitespeed.io

You can install these tool(s) using npm:

npm install sitespeed.io -g
sitespeed.io --help

Or Docker:

docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io/ --video --speedIndex

3. Lighthouse by Google

Lighthouse is an open-source tool for running audits to improve web page quality. It's integrated into Chrome's DevTools and can be also installed as a Chrome extension or CLI-based tool. It's an indispensable tool for measuring, debugging and improving the performance of modern, client-side apps (particularity PWAs).

Lighthouse performance

You can find the extension from the Chrome Web Store.

Or you can install Lighthouse, from npm, on your system with:

npm install -g lighthouse

Then run it with:

lighthouse <url>

You can use Lighthouse programmatically to build your own performance tool or for continuous integration.

Make sure to check these Lighthouse-based tools:

Truncated by Planet PHP, read more at the original (another 4631 bytes)

28 Nov 2017 5:00pm GMT

Interview with Bradley Holt

bradleyholt Audio Show Notes Watson Developer Cloudi ZendCon 2017

The post Interview with Bradley Holt appeared first on Voices of the ElePHPant.

28 Nov 2017 12:30pm GMT

Refactoring Matrix

When you are beginning to consider refactoring your big legacy codebase towards a new software design, then it is not uncommon to feel helpless after estimating this to be a huge terrifying 2-5 years project. To help solve the problem of not knowing where and how to begin, we have had great success using a decision matrix to decide how each part of the legacy code should be changed in such a refactoring project. Two main factors should influence your refactoring decisions…

28 Nov 2017 8:43am GMT