I’ve recently been doing some work on some CLI tools, and I came across the need to “paginate” a long list of file. Instead of dumping out 40+ items to the screen all at once, which would be confusing and hard to read, I wanted a more elegant way of showing only a section on the huge list at once. Now this isn’t true pagination unfortunately as PHP doesn’t really support things like framebuffers and instead just writes directly to stdout. But it is an easy to use approach to only showing a slice of a big list at a time.
So there you go, a nice simple easy to use method for “pagination” in CLI environments. I’m sure there are a few improvements that could be made to make it function more like
Controller::paginate(). But for the time being this solved my problems.