Largely ignored under PHP5, the SPL (Standard PHP Library) offered a powerful toolbox for developers, ranging from it's horrendously named collection of Iterators, and a series of Interfaces allowing us to build our own, to DataStructures, and Object Oriented file handling classes. Fast and powerful, the SPL provided a stable and well-tested library of classes and functions. But with all the performance and memory improvements of PHP7, SPL has remained unchanged, and feels like it has been left behind. Now, Generators provide a simpler replacement for writing our own Iterators without all the boilerplate code that SPL's core Iterators require, especially with the introduction of "yield from" in PHP7 for recursive Iterators.

And PHP7's performance improvements allow us to write our own Datastructures (based around standard PHP arrays, or custom objects) that are as efficient as SPL's basic Datastructures.

So does SPL still have any purpose or value in this new world of PHP7? Let's find out!

Comments

Comments are closed.

Eugene Kaurov at 16:24 on 22 Sep 2018

I appreciate measurements.
But I really believe it can be shorter, more emotional, with simple ptactical usages

Matter-of-fact talk about probably one of the most-neglected topics in PHP. Loved your assessment of the future of the respective SPL components.

Susanne Moog at 23:45 on 26 Sep 2018

I liked the presentation and the style in which it was given.