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

Oh Dear Blog:
How to size & scale your Laravel Queues
Nov 02, 2018 @ 18:17:03

On the "Oh Dear!" service's blog there's a recent post covering the use of queues in a Laravel application and how to size and scale them to most effectively use the resources you have.

Laravel offers a convenient way to create asynchronous background tasks using its queues. We utilize those heavily at Oh Dear! for all our monitoring jobs and in this post we'll share some of our lessons learned and what we consider to be best practices.

The post starts out with an introduction to queues and their handling in Laravel applications, pushing jobs into workers to be executed. While a simple single-worker queue can handle a decent amount of work, problems can arise as the work grows larger. He mentions splitting up the work as a potential solution and defines the differences between "fast" and "slow" jobs to act as a dividing line for the queues. He also makes the suggestion of single-purpose queues based on types and, finally, mixing in the idea of a better user experience through immediate feedback.

tagged: size scale laravel queue division tutorial

Link: https://ohdear.app/blog/how-to-size-scale-your-laravel-queues

Exakat Blog:
Largest PHP applications (2018)
Mar 19, 2018 @ 16:35:46

On the Exakat blog there's a new post that includes the details of the largest PHP applications currently available (and popular) based on their own scanning of Open Source Projects.

When testing the exakat static analysis engine, I need to run it on real code. Open Source projects are a real blessing there, since they come in different shapes and stripes. [...] Nowadays, code bases tends to be smaller, compared to more ancient applications. Components are the norm, and they impact both the development of the application, and its extension.

[...] For this survey, we collected 1885 Open Source applications, and counted only their tokens. Tokens are PHP atomic elements, that are needed to understand and run code. Comments, white spaces and delimiters were not counted, leaving only the useful tokens. Then, the more the larger is the application.

The post lists out the top 100 largest PHP applications (by tokens, not by line) including:

  • Magento2 (#6)
  • Drupal (#12)
  • Yii (#21)
  • Joomla (#36)
  • Symfony (#52)
  • Apigility (#80)

The list comes with the count of tokens and is an update of their 2016 largest PHP applications post.

tagged: large application token size project opensource scanner

Link: https://www.exakat.io/largest-php-applications-2018/

Christian Weiske:
PHP: Allowed memory size exhausted
Jul 12, 2016 @ 17:17:20

Christian Weiske has a post to his site with a reminder about a common misconception that can happen because of the wording in a standard PHP message about memory exhaustion.

The indieweb.org wiki has a page about Wordpress with a Criticism section. ?

One of those "issues" listed is Fatal Error memory exhausted [...but] I removed that section because it's nonsense to list a server configuration issue as Criticism.

While the admins reverted the change to put the message back, Christian clarified what meaning of the error message to help clarify the situation. In the case if the example message, the "32 bytes" it mentions is not the amount of total memory it's trying to allocate, it's the amount it last tried and failed at. Christian also points out the role that PHP's own memory_limit setting has on when this message might pop up.

tagged: allowed memory size exhausted error message clarification

Link: http://cweiske.de/tagebuch/php-memory-exhausted.htm

Andrew Smith:
Why is Slim 3 not so slim anymore
Aug 03, 2015 @ 14:54:13

In this post to is site Andrew Smith refutes the misconception that version three (v3) of the Slim PHP microframework is "not so slim" anymore with some of the additions to this latest version, increasing it's size and complexity.

There is a common misconception that Slim 3 has plenty of files and is no longer slim. Slim 3 does indeed contain more files than Slim 2 and this has been the result of being more flexible and moving away from the Not Invented Here (NIH) philosophy.

Installing Slim 3 through composer will install all its dependencies, when doing a PHP file count you will notice we have doubled in file count. This is a given with the amount of flexibility we now have. Most developers might not see any benefit in this as they will likely just work with what is provided, but if at any point you should hit a limitation in any working part of the framework, you can easily swap it out without a fuss.

He includes the command to install this latest version via Composer and how to count the number of files with a single command. He points out that some people that are reporting 1000+ PHP files being installed with the framework are probably getting the development packages as well and not just the release. He points out that "Slim 3 is still slim, we just added more flexibility in it." He ends the post with a thanks to Josh Lockhart and a few others who have made large contributions to the project and have helped make it what it is.

tagged: slimframework version slim3 slim2 size improvement flexibility

Link: http://thoughts.silentworks.co.uk/why-is-slim3-not-so-slim-anymore/

Emanuele Minotto:
PHP in a Tweet
Sep 14, 2012 @ 15:19:09

Emanuele Minotto has a recent post with a set of "PHP in a tweet" posts that do all sorts of things.

Yesterday an ex colleague tweeted something that captured my attention, so I started thinking to a Twitter-powered code golfing competition. Looking for other examples.

Tweets included in the list are snippets like:

  • A dependency injection container
  • A super simple web framework
  • A microframework
  • Bypassing array_intersect

There's some game rules included in the post so you can contribute your own to the the comments. Several have already been added including a base64 encoding variant and getting the extension of a file.

tagged: tweet size code twitter framework dic

Link:

Ilia Alshanetsky's Blog:
PHP's Output Buffering
Dec 08, 2011 @ 16:01:15

In a new post to his blog Ilia Alshanetsky takes a look at PHP's output buffering feature and some interesting things he found when testing some recent code (hint: it has to do with PHP's "interesting" management of the buffer).

While profiling our application I came across a a rather strange memory usage by the ob_start() function. We do use ob_start() quite a bit to defer output of data, which is a common thing in many applications. What was unusual is that 16 calls to ob_start() up chewing through almost 700kb of memory, given that the data being buffered rarely exceeds 1-2kb, this was quite unusual.

Through a bit more testing he found that, if a buffer provided for content isn't enough, PHP automatically bumps it up by 10kb each time - a waste of resources if you only need a small subset of that. He includes a small patch he made to the PHP core API that allows for defining a custom buffer size and, if it's not enough, bumps up the buffer size by 1kb instead of 10kb.

tagged: output buffer increase patch custom size

Link:

Kevin Schroeder's Blog:
fatal: The remote end hung up unexpectedly
Nov 04, 2011 @ 17:55:28

Kevin Schroeder has a quick tip for anyone using phpcloud.com and having trouble with git and "remote end hung up" error messages.

If you are using phpcloud.com and are experiencing errors with git [...] and you are trying to push large files (not sure what is defined as "large") you may need to change some git settings.

He points out two settings - one for Windows and the other for Linux - that increase the buffer size to handle larger files that might be included in your repository.

tagged: phpcloud git problem large file buffer size

Link:

Jeez Tech:
Damn Small PHP Frameworks. Because size does matter.
Sep 17, 2009 @ 18:54:22

In this recent post to the Jeez Tech blog they take a look at some of the small, lightweight frameworks out there.

They look at five different frameworks:

A few other frameworks are also mentioned in the comments like the micro-framework limonade and Madeam.

tagged: small framework size

Link:

Sameer Borate's Blog:
PHP built in functions map
Jan 16, 2009 @ 15:31:22

Sameer has put together a few images, the results from the Wordle website when he plugged in the names of the built-in functions included in PHP.

The application is simple. You enter a bunch of text and Wordle does the rest. The applet provides options to change color, font and layout. Just for fun I created a Wordle cloud to display php’s built in functions. Two samples are shown below. The size of the font in the cloud is proportional to the number of functions starting with the particular name.

Among the largest on the list are words like "array", "get", "mysql" and "mcrypt". He used a call to the get_defined_functions() method and looped through the "internal" subarray to build his lists.

tagged: function wordle builtin output image text size

Link:

Stefan Mischook's Blog:
Podcast: Structuring PHP Projects
Nov 11, 2008 @ 16:25:52

Stefan Mischook has posted a new podcast that gives an overview of things to consider when structuring your application.

In the following podcast I go over the key factor when determining how to structure a PHP project. In a nutshell, it comes down to the size and complexity of the job. For the details, listen to me yap.

You can download the mp3 directly from his site. For more great PHP tutorials, check out his videos section.

tagged: podcast structuring project tutorial video factor complexity size

Link:


Trending Topics: