SitePoint PHPPagination with jQuery, AJAX and PHP (27.5.2015, 16:00 UTC)

In this article, we’re going to explain how easy it is to paginate your data set using PHP and AJAX via jQuery. We’re also going to use the Silex framework for simplicity.

jQuery Logo

The data source

First off, we need some data to paginate!

id name age
1 Jamie 43
2 Joe 24
3 Fred 23
4 Clive 92
5 Roy 73
6 Geoff 24
7 Ray 12
8 John 9
9 Pete 32
10 Ralph 34

For the purpose of this example we’re going to use MySQL, but of course we can swap this out easily for SQLite or any other RDBMS. We’re going to name our database example and the table will be named people.

The backend

As we’re going to build our application on Silex, we need to install Silex using Composer first. Install it through composer with the command composer require silex/silex.

Next we need set up our index.php file, connect to the data source and select the database. We’re going to use PDO for this as it is easy to change to other database software later, and it also handles escaping user input (thus preventing SQL injection attacks). If you’re still stuck on the mysqli or even worse the mysql extension, see this tutorial. We’re going to put the connection in the $app container so it’s easy to use later in our routes.

Continue reading %Pagination with jQuery, AJAX and PHP%

PHP ClassesCreate a Google Maps alternative with PHP and MySQL using the Leaflet library (27.5.2015, 10:09 UTC)
By Ashraf Gheith
Leaflet is a JavaScript library that became popular for creating mobile friendly Web maps applications. It does not depend on Google, so you do not need to pay fees as you may need to when you use Google Maps.

Read this tutorial to learn how to use Leaflet library with PHP and MySQL to create an alternative to Google Maps and implement it on your site.
Qafoo - PHPDevelopers Life is a Trade-Off (27.5.2015, 08:58 UTC)
At Qafoo, we train a lot of people on topics like object oriented software design, automated testing and more. It happens quite often that an attendee asks questions like "Which is the best solution for problem class $x?", "What is the optimal tool for task $y" or "There is a new technology $z, is that the future of web development?". Some are disappointed when I reply "It depends" or "That does not exist", but that's the truth.There is no silver bullet and one of the most important skills every developer needs to hone is to assess possibilities and to find the best trade-off for the current challenge.To make that point clear I'm giving three examples from my personal experience, some where it went well and some where it did not.
Michelangelo van DamLittle things can make a difference (26.5.2015, 22:37 UTC)
Source: theleticiabertin on

Wow, I never expected this much involvement when I created an overview of upcoming conferences this fall. I cannot deny I love Markdown to write simple things and I love simplicity. I use IA Writer to have distraction-free editing power on both my phone and laptop.

iA Writer

iA Writer is a minimalist text editor for OS X and iOS developed by Information Architects Incorporated. The idea of iA Writer is "to keep you focused on just writing". iA Writer has been "downloaded 600,000 times by everyone from hobbyist writers to the bestselling author Augusten Burroughs." It is the top selling text editor in the App Store behind Apple's own Pages application.

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

Nomad PHPPHP 7 the Big 5 + 1 (26.5.2015, 20:15 UTC)

PHP 7 the Big 5 + 1

Presented By
Cal Evans
DATE 20:00 CDT

The post PHP 7 the Big 5 + 1 appeared first on Nomad PHP.

Nomad PHPDriving Quality with PhpSpec (26.5.2015, 17:00 UTC)

Driving Quality with PhpSpec

Presented By
Ciaran McNulty
August 20, 2015 20:00 CEST

The post Driving Quality with PhpSpec appeared first on Nomad PHP.

Lorna MitchellRecover Bitly Bundle Data (26.5.2015, 14:57 UTC)

For some years I've been creating a bundle of links covering articles I recommend for various topics in the Zend Certified Engineer Exam (if you can here looking for the bundle itself, it's at This was done using bitly's bundles feature, which I thought was a great way to share links. In fact I had 10-15 bundles that I had created from collating all the links in a particular training course or talk, so that people didn't have to try to write down URLs as I went along. Unfortunately they sunset their bundles and then removed them completely, and I missed the announcement (it all happened quite quickly, they'd seen some abuse of the feature, it's free, all totally reasonable) BUT they also didn't respond to my support questions about how to recover the data.

It turns out, it's an undocumented feature on their API, so here is everything I know about recovering your bundle data, including the script I used to rescue my own data.

Bundle Data Via API

The endpoint you want is /v3/user/link_history and the documentation is here: Many MANY thanks to @jehiah for tweeting this information at me, it was a huge help! What they omitted to mention is that you'll also find a "tags" array in the values for each link as well (I assume the documentation will update really soon).

Bitly also has an API browser so you may be able to get your data out through that without needing code. I'm a programmer though so I wrote a script ...

Bitly Bundle Rescue Script

Here's my scratty script to export data. You need to do 3 things to use this:

  1. Add guzzlehttp/guzzle to your composer.json file and install it
  2. Use the instructions in the comment at the top to get your access token (or use the bitly web interface
  3. Look around line 55 and comment/uncomment as appropriate depending on whether you want a CSV export or an HTML output

require "vendor/autoload.php";
 * To request access token:
 * curl -u "username:password" -X POST ""
 * Composer: composer require "guzzlehttp/guzzle": "~5.3"

$access_token = 'GenerateYourOwn';

$client = new GuzzleHttp\Client();
$offset = 0;
$limit = 100;

while(true) {
    $response = $client->get('',
        ["query" => [
            'access_token' => $access_token,
            'limit' => $limit,
            'offset' => $offset,
    if($response->getStatusCode() == 200) {
        $responseData = json_decode($response->getBody(), true);

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

Paul M. JonesRadar: Answering Questions, and New Middleware (26.5.2015, 13:23 UTC)

Last week’s announcement of Radar, an implementation of Action-Domain-Responder using PSR-7, was a resounding success. The feedback has been mostly positive, with some confusion and misunderstanding, and with one particular question being raised more than once.

This Reddit thread is typical of the various questions and comments I’ve received so far:

[“ADR” is just] the hipster slang for ‘c’, ‘m’ and ‘v’.

In other words, “Why ADR in the first place, and not just MVC?” This is answered by the ADR white paper, and again by some commentary here. In short, ADR is a refinement of “web” MVC to more accurately describe how we actually work in a request/response environment. The renaming of the components is intended to break the association with “real” MVC. (Special thanks to “lordofworms” for his patient and civil responses to the questioner.)

Why [is the project called] “Radar”?

As noted in the Reddit thread by others, “Radar” is a sound-alike from the ADR acronym. (An early version of the ADR paper was titled Request-Action-Domain-Response, the acronym for which lends itself even more to “Radar”, and I had that in mind too.)

why use classes at all? If most of your classes contain a single __invoke method, could they not just be substituted with namespaced functions?

The questioner was answered quite thoroughly on Twitter. I will add only that there’s nothing about ADR that says you must use classes. If you can implement ADR using all functions all the time, go for it. ADR is a pattern, not an implementation; Radar is an implementation, not a pattern.

Finally, we have this very good criticism referring to the middleware implementation:

Passing arguments by reference will confuse users.

Variations on this theme came up elsewhere as well. As a result, I have re-worked the middleware implementation completely.

Previously, Radar used a “filter” style of middleware, where an iterator calls each middleware handler in turn at different points in the execution path. This is the style used by Slim 2 and Silex, and works well with globally mutable request and response objects.

However, PSR-7 requests and response are immutable. I have not previously used immutables very much, and I tried to subvert the immutability by allowing middleware to use reference parameters. The references would make the request and response objects appear globally mutable, even though the objects were in fact immutable.

The critics who noted that this was potentially confusing, as well as a subversion of the immutable intent, turned out to be worth listening to. I experimented a bit with a wrapper-style (or chain-style) of middleware, and I’m much happier with it.

In the new implementation, each middleware calls the next one in turn, instead of an external iterator looping over them. (There is a Dispatcher object that “holds” the queue of handlers, and that it what gets passed to each handler for its $next call.) I got the idea from reading MWOP’s Conduit code, although this is greatly pared down from that. You can read more about the new implementation here.

Ben RamseyWebsite Redesign (26.5.2015, 13:00 UTC)

Welcome to my brand new website! I’ve worked hard to make this site, and I hope you like it.

My blog has been around since 2004. My first blog post was written about the PHP Community project. Back then, I used Movable Type as my blogging engine. WordPress was still young, having only recently been forked from b2. A few months later, I did switch to WordPress, and then many years after that, I decided to use a static site generator, so I switched to Octopress.

Why Redesign?

There were several things that prompted my desire to redesign this website:

For one, I was inspired by the branding efforts of Yitzchok Willroth, Chris Hartjes, and Chris Shiflett, and I wanted a personal web presence that would better communicate who I am and what I do.

Second, I wanted a project that would take me back to my web development roots, and I felt that developing a personal website with all the bells and whistles would do just that. Through this process, I’ve been able to learn more about HTML5 and CSS3, as well as responsive website development.

Last, I wanted to encourage and inspire others to follow suit. A decade ago, most web thought leadership conversations took place across blogs, and from blogs, leaders innovated and led the development of the Open Web. However, since the advent of closed, microblogging platforms, many (myself included) have left their blogs behind in the dust, and I feel we’ve lost some of that innovation and openness. This redesign represents the beginning of my return to the ideals of the Open Web.


Why do you do what you do? I am a web developer because I believe the web has the power to change the world. It is the biggest communications tool of our time, and it has the greatest power to effect change—if used appropriately. I have a passion for teaching web development because I want to encourage others to use these skills to change the world for good.

I have been inspired by my friends at Fictive Kin to create a /purpose (Slash Purpose) page, and I encourage you to think about why you do what you do and create your own /purpose page. Let it drive all that you do.

Here is my /purpose page.

IndieWeb Movement

Through Chris Shiflett, I found out about the Indie Web movement. Almost immediately, I felt a kinship with this community. I’ve already mentioned the Open Web philosophy. The Indie Web movement seems to be taking steps in this direction. I have followed their “Getting Started” guide to mark up my website with authorship information (h-card) and microformats mark-up for blog posts and articles (h-entry). This means my site content is easy to scrape, and it provides good identity information about myself that machines can read.

Chris has written a little about some of the practical applications of IndieAuth. I’m sure he’ll write more, so I encourage you to follow along.

Focus on Content

Previous versions of my website included only my blog and did not focus on my talks, articles, books, or projects. It is important to me to showcase this content, and so this new version of my site includes these and more. Just take a look under the Features navigation link up top, or follow these links:

I write about web development and related technologies in my blog. Usually, it has somethi

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

PHP ClassesReview: Build APIs You Won't Hate (26.5.2015, 05:51 UTC)
Build APIs You Won't Hate
Dave Smith
Web development books
Phil Sturgeon
So you want to build an API, or perhaps your boss is making you since you are the IT person? If you want to build one that you, or your boss, won't hate, then this is the book for you.

Navigating the world of network services can be a daunting task for the uninitiated. This publication, Build API's You Won't Hate, gives clear and detailed instructions on how to build a REST compliant API, start to finish, and guides you through the pitfalls you should avoid. I would recommend it for any API developer at any level.

If you prefer reading it in your mother language, the good news is that at the time of this writing, the book is already translated into Portuguese, Turkish, Italian and French.
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP