PHP Classes

Can PHP Run Faster as Module of NGINX? - Lately in PHP podcast episode 61

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Can PHP Run Faster as...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  


Viewers: 66

Last month viewers: 4

Categories: Lately in PHP Podcast, PHP opinions

A recent article in the NGINX blog claims that its thread pools feature can enhance the performance by 9 times of that Web server.

PHP core developers have been debating the pros and cons of implementing a new SAPI to make PHP work as NGINX module and hopefully take advantage of the thread pools feature to enhance PHP request serving performance.

This was one the topics commented by Manuel Lemos and Arturs Sosins in the episode 61 of the Lately in PHP podcast.

They also commented on the latest PHP 7 alpha and beta versions, PHP 5.4 EOL and PHP 5.5 releases going into security fixes mode, the 20 years of PHP and 16 years of the PHP Classes site, and many interesting PHP articles and book reviews published recently.

Listen to the podcast, or watch the hangout video, or read the transcript to learn more about these interesting PHP topics.

Loaded Article


Introduction (0:20)

PHP 5.4.42 and 5.5.26, PHP 5.6.10 released (1:13)

PHP 5.5 to go into Security Fixes Only in July PHP 5.4 EOL in September (3:37)

PHP 7.0.0 alpha and beta and Feature Freeze (7:03)

New PHP SAPI for Nginx using Thread Pools? (11:11)

PHP 5.6 Specification (16:38)

20 Years of PHP and 16 Years of PHP Classes (18:18)

Latest PHP Tutorial Articles (40:25)

Latest PHP Book Reviews (50:27)

JavaScript Innovation Award Winners of April 2015 (1:00:11)

JavaScript Innovation Award Rankings of 2015 (1:05:00)

PHP Innovation Award Winners of April 2015 (1:07:00)

PHP Innovation Award Rankings of 2015 (1:12:04)

Conclusion (1:15:06)


Listen or download the podcast, RSS feed and subscribe in iTunes

Watch the podcast video, subscribe to the podcast YouTube channel

Read the podcast transcript

Click on the Play button to listen now.

Download Size: 66MB Listeners: 1468

Introduction music Harbour used with explicit permission from the author Danilo Ercole, from Curitiba, Brazil

View Podcast in iTunes

In iTunes, use the Subscribe to Podcast... item of the Advanced menu, and then enter the URL above to subscribe to this podcast.

Watch the podcast video

Note that the timestamps below in the transcript may not match the same positions in the video because they were based on the audio timestamps and the audio was compacted to truncate silence periods.

See the Lately in PHP podcast play list on YouTube and Subscribe to this channel there.

Show notes

Introduction (0:20)


Manuel Lemos: Hello. Welcome to the Lately in PHP podcast. This is Episode 61. At least over here, this time of the year, it's getting colder and colder. But it seems the other side of the planet, exactly from Latvia, there is Arturs Sosins that seems to be very happy. He's probably not getting much cold these days.

Hello, Arturs. How are you doing?

Arturs Sosins: Yeah, actually it's been really warm here, and we could even go and swim, and that's really nice.

Manuel Lemos: Yeah, you go and swim because it's just ten degrees and really hot.

Arturs Sosins: Eighteen, 18.

Manuel Lemos: Eighteen. It's probably the same temperature over here, but since I became a Brazilian now, I have cold, unlike in the past.

PHP 5.4.42 and 5.5.26, PHP 5.6.10 released (1:13)

Manuel Lemos: But anyway, we are here to talk about PHP and many things that had been happening. Actually this month, the PHP world is kind of on vacation, so nothing much has happened, but some things interesting happened.

So let's start with the usual coverage of the latest PHP releases, starting from PHP 5.4.41. Well, as we always mention, PHP 5.4 is in security fixes mode, so all these bugs that were mentioned here are related with security.

For PHP 5.5.25, there are a few more bugs that were fixed unrelated with security, I think, but as I was trying to mention PHP 5.5 is going to also enter into security fixes mode soon. Probably, when you watch this, the next release will already be just security fixes.

And as for PHP 5.6.9... Wait a minute. No, it's .9?

Arturs Sosins: Yeah.

Manuel Lemos: No, it's .10. I just did not fix the... Actually, it's also my mistake. I did not bump the numbers of PHP 5.4 that I was showing.

So we should have been looking at the PHP 5.4.42, which are still about the security fixes. PHP 5.5.26 with some other bugs, nothing specific worth mentioning, and PHP 5.6.10, which continues to be maintained.

PHP 5.5 to go into Security Fixes Only in July PHP 5.4 EOL in September (3:37)

Manuel Lemos: As I was mentioning, as you may see in the schedule here. PHP 5.5 will have active support until July 10, which means that after it will enter into security fixes mode.

Arturs Sosins: Yes, for us, it's tomorrow.

Manuel Lemos: Yeah, for us, it's tomorrow, but for whoever is going to watch this recording, probably, it has already passed.

Arturs Sosins: Yeah, probably already... Yeah.

Manuel Lemos: Yeah. Other than that, then later...

Arturs Sosins: In September?

Manuel Lemos: In September, it will be the end of line 4, PHP 5.4. Nothing bad will happen that day. It's just that since there will be no more new PHP 5.4 versions, some host may consider upgrading the PHP version they are using.

Arturs Sosins: It seems only recently, we buried 5.3 version. Now, it's already 5.4. They are outdating really fast.

Manuel Lemos: Well, this is more psychologic because many people do not control the exact version of the PHP that they will use because it's decided by their virtual hosting company. So this is more up to the hosting companies than to the actual developers. The idea that since we are coming close to PHP 7, it would probably will not make much sense to maintain like five older versions.

Arturs Sosins: Yeah, yeah. Of course not.

Manuel Lemos: So when PHP 7 will be released, there will still be two versions by then.

Arturs Sosins: And it's a different one.

Manuel Lemos: Yes, it will always be like three active versions. One, security fixes mode, and another older, and the newer version.

Well, OK, this is just to mention that these dates are coming, and if you are concerned, you should keep in mind, that at least for these versions, there will be no more bug fixes after a certain date.

And here, there is an article by Julien Pauli, which is the release manager of PHP 5... not all versions but I forgot which was the first one that he started. Anyway, he just announced that PHP 5.5 was going to enter security fixes mode, although they mentioned different dates here.

Well, anyway, I think what matters is what is in that page, this page, because this is the official information about the schedules.

PHP 7.0.0 alpha and beta and Feature Freeze (7:03)

Manuel Lemos: Talking about PHP 7, we already add two PHP Alpha versions, and I think Beta 1 was already released or not. Now, not yet, Beta 1 was not yet released, but it's due soon.

Arturs Sosins: Announced.

Manuel Lemos: Yeah. Well, probably, by the time people are watching this Hangout, Beta 1 was already released. The difference is that there will be something, what they call feature freeze, which means any features after this date... They mentioned here July 9th.

Arturs Sosins: Which is today.

Manuel Lemos: Yeah. After this day, they will not change the features. They will only be stabilized. Actually, I thought feature freeze happened a few months ago in terms of planning of the features. So there may be a slight difference of interpretation of what feature freeze means.

Anyway, you should not be concerned if you are not really looking at PHP 7 as it works right now, because in my experience, what happens is most developers tend to just wait for the official release to be out to actually try it. And only then you'll see loads and loads of bug reports. After months of planning these releases, finally people will report the bugs that they should have been reporting during the Alpha and Beta stages.

Arturs Sosins: So your suggestion is to wait for official release, and then wait a couple more releases.

Manuel Lemos: No, no, my suggestion... I'm not suggesting anything. I'm just saying this is what happens in practice. It's very frustrating for developers that there is Alpha/Beta periods, but only a few people actually test the PHP versions and make useful reports about broken things.

Arturs Sosins: Yeah, I think that's a trend in PHP that everyone tends to stay on all this current version, possible which works and are afraid to upgrade and probably it's like that. Nobody wants to try to get a heads up, to even try it.

Manuel Lemos: It will break your applications, and you cannot do much because it's not your fault. That's the way it works. As long as people do not take years to upgrade finally to that version because they were afraid that their application will break, that's OK.

Well, anyway, now you know that PHP 7 is already in Alpha and Beta stages. If you are curious, if you go ahead and download, I'll post the links in the Show Notes, so you can go there and see how bad is your code running on PHP 7. Most people are getting very excited because it's really fast, but what about the features that were discontinued or had backwards incompatible changes.

Well, you need to deal with one thing at a time. I think, as usual, for major releases, adoption will take some time to really happen in a significant way.

New PHP SAPI for Nginx using Thread Pools? (11:11)

Manuel Lemos: So now, moving on to another topic, basically, there was a discussion that didn't go anywhere, just some people that consider it and did not like much of what's being proposed. It's that NGINX, which is getting more and more popular in the PHP world, Web servers in general, is getting a feature they call thread pools. It provide what they call the name, they say 9X performance boost.

I'm not sure but from what I could interpret, is that the request are handled by threads, and threads will be grouped in pools, built in the Web server. Because many people had been using FastCGI or similar approaches. The request are handled by separate process. The Web server just takes the request and forwards them to the separate process using some I/O communication.

With thread pools, all runs inside the process of them, of the Web servers, so it will be more or less like mod_php that you have in Apache.

There was a discussion in the PHP Internals about if PHP shouldn't have a dedicated SAPI, an interface with this Web Server in this mode. The discussion did not go very far, but the people that have spoken basically said that you probably would not get much performance because when you use thread-safe code, there is lots of locks to prevents that in terms of lower level C language. It will prevent simultaneous thread to access and change global variables... I mean global C variables, not global PHP variables. And those locks end up killing any performance boost.

So probably this is not something that they will focus. But we'll never know, maybe somebody will consider it and come back to the idea.

Arturs Sosins: It means they would have to modify the source to make the global variables volatile somehow. But all in all, I think that such and such...

Manuel Lemos: No, that's just the way PHP works in thread-safe mode. They have to use locks to prevent two threads change the same global variable.

Arturs Sosins: When using PHP, the first optimization method that comes to mind, since it's a single-threaded environment, then to cache everything you can in operated memory. In this case, threading server won't give you any boost, but probably only make overhead to threads because if you are fetching everything from RAM, then it basically gives you nothing.

Manuel Lemos: Yeah. Well, this article is about the way NGINX works. But I don't know if they are talking about static content or dynamic content generated by a language like PHP.

Arturs Sosins: Yeah, but reading the article, I can't really understand in which cases it would benefit me more than it would harm me. So, it's probably all about the testing on specific case.

Manuel Lemos: Yes, probably, that's what they mean. In certain cases, you can get 9X performance boost, but in all the other cases, you probably won't get anything.

Arturs Sosins: Yeah. The example on which they got 9X boost is when they were fetching some kind of large file. It's an I/O operation which in multi-threaded environment, of course, it would execute it better asynchronously.

Manuel Lemos: Yeah. That's probably one case that, even not a general case, probably will not benefit much but, OK, for those people that are obsessed about performance, they may want to consider it.

Anyway, for now, the discussion in PHP Internals is too... Nobody got excited about this, so at least for now, there will be no specific SAPI for PHP to support this mode of NGINX.

PHP 5.6 Specification (16:38)

Manuel Lemos: So moving on with the next topic, just to briefly mention that there was announcement of a PHP specification. Actually, they completed a specification for PHP 5.6, which basically the specification for this is a formal document that say that PHP should work like this, PHP should work like that.

Arturs Sosins: And by they, you mean Facebook.

Manuel Lemos: Well, it was a project started by Facebook, but then they ended up gathering the collaboration of other core PHP developers. Of course, this is more interesting for Facebook because they are the ones that have one of the probably better known implementation of PHP apart from the Zend-based implementation which is the one based on HHVM.

So with this specification, they can guarantee that their implementation will go in line with the main PHP specification. And if there is an implementation that is broken because it does not comply with this specification, people are just brought the attention to whatever is different and should fix it to make it compliant with this specification. There are other implementations, but I don't know if they are really concerned with this specification.

20 Years of PHP and 16 Years of PHP Classes (18:18)

Manuel Lemos: OK, now moving on with another topic, we are just going to briefly mention the fact that in June, PHP Classes completed 16 years of age. Hooray, happy birthday PHP Classes.


Arturs Sosins: That was in June, right?

Manuel Lemos: Yes, it was in June 24th.

Arturs Sosins: And you said that this one wasn't special publication. It is kind of special.

Manuel Lemos: What do you mean?

Arturs Sosins: In the beginning of the podcast, you said, that this month, there was nothing special. It's like all PHP is on vacation.

Manuel Lemos: Yeah, because it's...

Arturs Sosins: There is something special.

Manuel Lemos: That's just the way I deal with birthdays. Personally, I don't celebrate my own birthday, just so you know.

It's another year. It was a lot of work and many things changed. The new features that the site needs require a lot of work, so seems to go slowly. Coincidentally, there was also the 20th birthday of PHP. So I just thought, let's put both topics on the same article.

Arturs Sosins: It took you for years to run PHP and build a website.

Manuel Lemos: Yes, I was learning. Actually, I started PHP, according t this... If this is the real official birthday, 20th birthday of PHP, this means PHP was started on 1995. I started working with PHP 2 in 1997, but PHP 2 did not supported objects. Only PHP 3 started having classes, which happened in 1998. So in 1999, I started PHP Classes.

It 's not like I was waiting for that, but...

Arturs Sosins: You could not make when PHP do not support classes, so it makes sense, right?

Manuel Lemos: No, but before that there was a site by... I even forget the name, it's so old... that I used to send my first classes before I had PHP Classes.

Arturs Sosins: Value wise?

Manuel Lemos: Well, no, there was the... It was called PX by David Sklar. It was a sort of a script site. You send your script and share them with them. But I wanted to be able to notify people when there were new versions of each class. I even talked with David if he would be willing to accept contributions to improve the site but he didn't feel interested, then I started PHP Classes. That's the basic story.

But before that, I was already submitting classes to that site. So it was already after PHP 3. Anyway, I was talking about the 20th birthday. It's just to mention just a few facts. It's not worth repeating what many other articles talked about the story of PHP.

There were people from the PHP community posted a series of tweets about all relevant events of PHP history. They were nice. They even mentioned the birth of PHP Classes among many other events that happened in all these 20 years.

But what I wanted to mention about this article is well, PHP community is sort of very compartmentalized. There is the Framework people, the WordPress people, the Drupal people, and each section of the PHP community sometimes seems to be isolated. They do not have much in common.

There is this effort of PSR to define specifications for interoperability of frameworks. Still, it's the Framework people. They define a few specifications, but they didn't like, for instance, they didn't like they did in the Java world... they defined specifications for APIs that could be implemented by different frameworks.

It's more like coding styles and conventions, and not really something that would allow to switch from one framework to the other. So they collaborate but at the same time, they don't seem to be letting it go for their users to switch to another framework.

That's the difference between what we have in PHP and the Java world. They have the JSRs, Java Specifications and Recommendation. You can even switch two virtual machines, and in theory, your application will still work. We know that's not accurate but at least that was the intention.

So this is just to mention that PHP is still very compartmentalized. The community is large, but it could cooperate more than...

Arturs Sosins: Yeah, I think, that's the problem, that community is too large.

Manuel Lemos: Yeah. And it's not just that, some people just see other sectors as competitors rather than collaborators. So the Framework people don't like PHP Classes because PHP Classes lets other developers to get lots of exposure to their own frameworks, and that's more competition. Some people write crappy code and send to PHP Classes, so that the fact that people write crappy code is PHP Classes' fault. Of course not. It's that's just the reflex of the PHP community that we have. It's not really something that you can blame to a single site.

Some people, "Oh, no, I don't like PHP Classes. I like GitHub." And then, many of the contributors that submit classes to PHP Classes, they import them from GitHub, which is curious.

Arturs Sosins: Which is easy to do.

Manuel Lemos: Yes, exactly. So it's not PHP Classes' fault. It's not GitHub's fault. It's just the fact that PHP is so popular that we'll have great people writing excellent quality code. And then, you'll have less experienced people writing your quality code. Blaming it on PHP Classes is just something very, very, I would say, probably somebody that is defending somehow their repository or something.

Anyway, well, just regarding this document, this article, I also mentioned about the PHP 7 Event, which was also a very big thing. Many heated discussions we've been covering all these months. One of them, probably one of the hottest is about having strict typing in PHP, because PHP is a dynamic language. You can't have strict typing.

Finally, there was a proposal that was approved, lots of people voted in favor but also lots of people voted against. But OK, at least now, you can have a solution that can please more or less both of the worlds. Other than that, I think the major thing that would get people attention to PHP 7 will not be strict typing but would be rather performance improvement.

PHP 7, actually, what is called PHP 7 was somewhat based what they call initially PHPNG. It was just an effort to evaluate, bringing a JIT solution to PHP and the core PHP implementation because HHVM or Facebook already have their own JIT solution. There are people that disagree with this interpretation so take it just at my point of view, not necessarily a point of view that everybody agrees.

Well, it doesn't matter because what we got is that there was a big effort to improve PHP performance in many ways besides considering the JIT solution that, in the end, we don't have yet at least for PHP 7.

What matters is that the performance gains are going quite on par with HHVM PHP implementation. So all these competition between PHP core developers and Facebook developers turned out to be very healthy thing because it motivated many people to work on making PHP run faster.

Other than that, I just finished the article talking about asynchronous programming thing, which is still what I think is missing in PHP. There are implementations for asynchronous programming but they all look very much like what we currently have in the JavaScript world, which is all is dealt with callbacks.

We know there is this callback hell expression that we don't enjoy much. Probably , that's one of the things that turn down many people that consider to switch to Node.js instead of PHP because it's not really nice.

But one new thing to consider is that ECMAScript 6... which is the next generation of JavaScript... already implements something that will make asynchronous programming more pleasant, which is the "await" keyword, which by coincidence or not, we also have in the Facebook Hack language.

Basically, it lets you... When you have an asynchronous operation for instance connecting to a server, you can just use the await keyword and in your code, you write whatever happens after the task is completed without using callbacks.

And since this is available on ECMAScript 6 and the next version of Node.js or IO.js which is a fork of Node.js, when it would be available, that will be one last thing for developers to complain against Node.js.

So I think it's possible that many PHP developers will start to move to Node.js by then, but OK, this is futurology. This is just my opinion. I don't know, Arturs, what do you think? Is it something reasonable that you can expect?

Arturs Sosins: Why not then Hack language instead of Node.js, if they have similar functionality with the await keyword?

Manuel Lemos: Yeah, well, I don't know. Hack language has other issues like for instance, being controlled by Facebook. Some people are against Facebook.

Arturs Sosins: Sure, sure. It will be an issue for many people, I agree.

Manuel Lemos: Yeah. Well, they didn't know what the future is. For instance, if Facebook stops supporting the Hack language, what happens then? Well, I don't know. Some people are afraid to go there.

Other than that, for the JavaScript world, there is this supposedly advantages that people, if they do the server-side in JavaScript and the client-side in JavaScript, it's just one language they need to learn. That's the temptation that some want to follow, or not. We don't know.

Well, one thing that JavaScript doesn't have, definitely at least for now, it's WordPress.

Well, there are content management systems, blog systems, based on Node.js or whatever, but it's not WordPress. They do not have millions of plugins. There will be no path for migration from WordPress to something else.

Arturs Sosins: On the system that I've been working, I also need to implement plugin system. And it's really hard to implement such systems in Node.js because how it is structured, that you need to restart the whole process to reload the packages. It's much easier to do something like that in PHP than in Node.js.

Manuel Lemos: Yeah, well, that's good to know, at least for those that are looking for arguments in favor of PHP.


Manuel Lemos: Well, we don't know. We know progress happens, and if in the future we have switched from JavaScript to something else, well, that's because it was a good thing. I don't know.

Well, there will be a lot to say, but we need to move on. Just to finish here, I have also mentioned a bit about some of the things that happened in the PHP Classes world.

Last year, we implemented the Package Recommendation Systems, which is meant to help users looking for packages for specific purposes. Instead of searching the site, which often does not give very good recommendations because they are general, not specific... they do not take in consideration specific needs of a project... this Package Recommendation Systems is meant to have some users advise others about packages that are interesting.

Lately, there was just an improvement on the Package Recommendation System which is I mentioned here below, which is the fact that if you... No, I don't mention here.

For instance, if you have a package, if ever somebody asked for a recommendation, there is no package, but one author develops a package right away for that purpose, you could recommend that package. But since it was not approved, you just can't.

So from now on, if you have a package that was not approved, you can recommend it. And then, the package is approved, it will appear as recommendation in that page. That also works as a flag, so I, as moderator, will also approve that package faster. Because there is this huge queue and that is something I'm very ashamed of because I've been so busy that I left the queue piling up like 20 to 30 package in the queue. I need to work...

Arturs Sosins: Oh, my God.

Manuel Lemos: ...faster to release that queue, but I've been struggling with time because I have parallel projects. Actually, one parallel project unrelated with PHP Classes but I'll try hopefully starting next week to approve more packages a day to make things go faster.

Anyway, another thing that I mentioned was the Innovation Award Championship of the Nations that went very well. We got many, many more authors contributing with innovative packages. This year, we have even more as we're going to start looking ahead when we just mentioned about the Innovation Award nominees of the month.

Other than that, there was also another thing that is taking me some time more than I had than before, which is the site is publishing quality articles, as well as book reviews. These authors of good tutorial articles are getting paid a fee, which is nice because it rewards them for the time that they take to write quality articles. We are also going to review of the month very quickly because there are so many, as well as the book reviews that had been published.

As far as future plans, there are things that are more concerning. For instance, the search system is not very good. Lately, I made some fixes that address one thing Arturs mentioned, about if you search for something with words with less than three characters, you would not get any result. So, I have some workarounds and, well, it is working better.

For instance, if you search for QR code in separate words, since QR only has two letters, what is happening is that it didn't return any results. I don't know why it's a limitation of the system. So in some cases, you will meet the words with less than two characters and other cases, just join them to the next word. For instance, QRcode will become just in one word, so there are many useful search results.

The idea is to replace this with a decent system probably based on Sphinx or Solr or ElasticSearch. I'm still evaluating but I also have to make time to implement this.

Other than that, one thing that I wanted to do is the package recommendations that already exists, they also appear in the search results. So if you search for QR code, and there are recommendations for QR code in the recommendation system, they will also appear in the search results page. So you get recommendations faster... not only get the results of the packages that exists, you also get people recommending certain specific package which hopefully will provide a better user experience.

Finally, I mentioned about book reviews and good articles. I plan to also allow authors, either developers or user groups to promote conferences and training events on the PHP Classes blog for free. If you are a company, you can advertise on PHP Classes blog posting the sponsor article, paying a fee. But if you are an individual or a user group... you probably don't have a great budget, but you are going to give a nice training event... you'd be allowed to promote your event for free and hopefully get more people to attend, and your event will be more successful.

Well, these are just the plans for the future apart from the things that I also mentioned that happened in the last year.

Latest PHP Tutorial Articles (40:25)

Manuel Lemos: So now, we are going to move on finally to the articles that were published in the site in the last month. We have many, many articles, many good articles. We are going to just mention them here very briefly because we are already taking a lot of time. We need to run.

One article here is a follow-up from the previous one about implementing a mapping system based on Leaflet, so you can implement your own mapping system without relying on Google Maps. So this article is a follow-up by Ashraf Gheith. It is built upon what he wrote in the previous article to implement a way to search for whatever is in the map. The search has a client-side and a server-side, which in the case is implementing PHP and MySQL.

Another article... this is probably interesting for you, Arturs... which talks about how you can use PHP to communicate with sensors in embedded hardware devices, like for instance those based on Raspberry Pi. Since they are based on Linux, they can run on Apache and yet PHP installed.

So Tom Freund... I'm not sure what is the right way to pronounce his name... wrote this article. It tells about that you have to have some adaptor programs, commands to actually talk the sensors, but you can call those programs with the 'popen' function.

Arturs, I don't know if you look at this article, if you felt it was useful. From what I remember, you are working on some hardware projects?

Arturs Sosins: Yeah, also. Well, for now at least, we are not interested in using PHP in that, but yeah, it's actually was interesting in the sense that it showed how you could use PHP if you wanted to. Of course, one specific system executing specific system commands but still, it's possible.

Manuel Lemos: Yeah, well, you always have to have some adaptor program, but you can at least have a common base, a common solution, that would work with the different type of sensors, types of device. Plus, this is sort of an abstraction.

Well, the next article, this one by Dave Smith. He has been sending a lot of very interesting articles. This one is about Hulu, which is a platform to serve movies, videos. They don't have an API, but they found a workaround it to, for instance, get the information about the movies using the support for embedding videos that they provide using embed, and also using the sitemaps that they provide to find what content they have there. So you could use that to, in essence, search their content and implement your own Hulu API, using that.

And for that, he provided a class that he developed and it is very interesting.

The next article, t his one is more to Linux users, basically simplifying your PHP applications testing using LXC. I actually I didn't know about LXC, but it is sort a lightweight virtualization technology that you can use, but I think you can only use it if you are already only on Linux systems.

This article from Alex Lushpai is very interesting, and he explains how it works. So if you are interested in virtualizing, like implementing different environments in your development, if you are using...

Arturs Sosins: Was is at beta?

Manuel Lemos: Yeah, could be. Well, why not? There is this LXC solution. Personally, I didn't know about it, but if I have the need to implement some virtualized solution, I'll take a look.

The next article, it's another by Ashraf Gheith. This one is about curating about an AJAX-based chat system. Well, AJAX is not new. Chat systems are not new. But he gives a simple step-by-step tutorial for those that would like quick and easy solution for this.

Arturs Sosins: Or to learn the basics.

Manuel Lemos: Yeah, actually, in reality, this is to explain about a class that he developed to implement this. He developed that class many years ago, but he has been updating the class to use more modern features of the AJAX implementations.

OK, the next article is interesting precisely because MySQL extension is going away. As we mentioned before, what will happen when that extension goes away, it will break lots of PHP code. Dave Smith wrote a class that implements the MySQL extension functions wrapped around the MySQLi extension.

So with this class, you can have a quick and easy solution that with just a few lines, you can make your application work well again in PHP 7 or even some earlier version that your hosting company already provided but has disabled MySQLi extension.

So this article talks about this class that you can use to very quickly solve your problem.

Arturs Sosins: Yes, so he also provides the class, right? There is a class?

Manuel Lemos: Yes. This article is a featured article, which means it's an article that was posted on the blog about the class, but since it was the general interest of the PHP Classes community, it was promoted to the main blog.

Now, I just noticed that I've been talking a lot without sharing my screen, and you did not worry.

Arturs Sosins: Yeah, I was looking at my screen.


Arturs Sosins: So I was busy.

Manuel Lemos: Well, anyway, moving on to the next topic, there is this article about Vagrant... again, another solution to implement virtualized development environments.

This one was written by Dmitry Mamontov, and this one is more towards those that do not use Linux systems and could not use LXC. They would need to use some other solution, and in this case, it tells what is Vagrant and how you can implement virtual servers on your machine for local development, because there is this interesting situation... it's that the vast majority of PHP developers use Windows. Then, there are also the Mac OS X users.

But in production, practical all or a great part use Linux. So how do they have a development environment that is as close as possible to the Linux-based environment that they have on production server.

Using Vagrant, Dmitry explains how you can solve your problem. He also explains how to deal with some of issues like generating keys and other problems that you may find when you are running your virtual environments with Vagrant. So this is a useful article.

Now that we talked about the articles, there are many more articles in the queue. Many of them are very interesting, but we like approving a couple a week. So there is also a queue for that. Unfortunately, there is a queue for everything because, as a moderator, I'm not elastic so I have to do it one at a time.

Latest PHP Book Reviews (50:27)

Manuel Lemos: Other than the articles, there are also good book reviews that have been published. So let's cover them very quickly. Again, actually, no, we didn't cover these ones.

The first book that we mention here is A Year With Symfony. This is an article about a book written by Matthias Noback. He's been a great Symfony enthusiast. And Joseluis Laso wrote a review about this book because he is also a friend of the Symfony framework, and it tells about everything that this book is about.

The next book, also by Matthias Noback, this one was also reviewed by Dave Smith. It's about how you can create packages with good design. This is probably very interesting for many authors that submit packages to the PHP Classes site. How they can provide packages that work well, follow good principles. He talks here about the SOLID principles and explains what they are.

I think you should read the review to understand what the book is about, and also buy the book because it will be useful to help you to create packages that are well structured and don't have some problems that others have.

The next review is about a book called Securing PHP: Core Concepts, written by Chris Cornutt. Again, this was reviewed by Dave Smith, and it talks about everything that you should know about security at the minimum.

If you don't know about these principles, you should, because being a developer is not just writing code. It's also to write code that works in a secure manner. This book was very well recommended by Dave Smith because he really like the way it was structured.

There is another book from Chris Cornutt about security, but it is not yet fully done. Let's hope that he finishes the book soon, so we can also have a good review about it here.

The next article is also about security. In this case, it was written by Ben Edmunds. The review was written by Samuel Adeshina. He also recommends this book very well. It's not exactly about the same things of the previous book, but certainly, there is an overlap. And it is also very well recommended.

The next article is about a topic that I think most developers didn't know they have. This book is...

Arturs Sosins: A problem you did not know you have, yeah?

Manuel Lemos: Well, actually, this is more about certain situations that may cause you performance problems. This book was written by Paul M. Jones, and the title is Solving The N+1 Problem.

If I understood this right, it is related with the fact, for instance, if you are implementing a CRUD system that you need to list entries of objects that you have in the database and those entries have related objects that you also need to query, to extract information, for each entry that you list you will have to perform N other queries to obtain the related information. On the hand, for instance, have "One to Many" relationship. Because of that, you may end up executing too many queries.

This book is about that. I'm sure that my explanation is probably not very clear and still a bit abstract.

Arturs Sosins: We can use a simple example. So like you select all PHP Classes authors, and then you cycle, look for them, and select each author's classes. So you execute N+ 1 queries for all N classes.

Manuel Lemos: Yes, and you could probably do it with just N querying out and everything.

Arturs Sosins: Yeah, exactly the equation.

Manuel Lemos: And this causes problems...

Arturs Sosins: ...because there are many possible solutions that have crossed, and one situation comes another.

Manuel Lemos: I think this problem is often caused when you are implementing an object-relational mapping solution that practically makes you query one object at a time. And if you want to obtain many objects, this problem may arise, you end executing too many queries. For instance, if you need to encapsulate all in the transaction, you may end up locking your database for a long time and cause scalability problems.

Anyway, it's better than me explaining here, it's better to read this review of Samuel Adeshina , and then buy the book because it is also well-recommended.

Another book also by Paul Jones is Modernizing Legacy Applications. And this, I think it's very interesting because many developers learn how to program in PHP many years ago. But the way things are done in PHP nowadays have evolved. People have different approaches that are more convenient, and that's why Paul has written this book, Modernizing Legacy Applications In PHP, to tell you "Oh, there are more modern ways to write applications." But what do you do with your legacy applications?

This book, also reviewed by Samuel Adeshina, is basically about what you can do to modernize your legacy applications with minimal impact, because some people think modernizing is writing the whole code. It's totally inviable to do that.

Also talking about this topic, Paul is giving an online workshop. I'm afraid by the time people see this Hangout, that workshop will already passed. But he posted an article in the PHP Classes blog telling about that workshop.

And that was one of the examples. Since this workshop was organized by an individual posting an announcement about that workshop, it's totally free, because it's the PHP Classes site helping good developers to promote good work.

Maybe by the time you watch this, that workshop has already passed, but at least you know it happened. Let's see if Paul organizes another edition of it. So you can attend next time.

Finally, there is another book about modernization. It's called Modern PHP. It was written Josh Lockhart and it was reviewed by Dave Smith again.

This is not about modernizing legacy applications. It is more about telling what are the current good practices that many developers follow in the PHP world these days. For that, the book is also very well recommended to everybody. Maybe you are stuck in old practices. Now, with this book, you can learn what are the good practices that are considered modern.

JavaScript Innovation Award Winners of April 2015 (1:00:11)

Manuel Lemos: Well, those were lots of books and lots of articles, but we finally reached one of the last section on which we comment about the Innovation Award. Let's start with the Innovation Award of JS Classes.

We start with the nominees of April. They were voted in May, and in June, the results came out. We have in April seven nominees, many packages at least for the average of the JS Classes site, which is great but will give us lot more work to comment about them.

Let me share here just to give you an idea. Ok, here they are.

OK, of these seven, which ones would you like to comment, Arturs?

Arturs Sosins: Let me share the screen and probably to zoom in also, right?

So, first one I wanted to comment is an interesting package by Andras Toth, which is called WDE: Web based editor for several programming languages. I was actually looking for something that I could write code online in, and it seems to be using some existing tool in extending it and implementing different features and even some testing using PHP integrations.

I wanted to try to see a demo but it seems their demo account was changed, and I can't log in. So it says wrong name or password, but still, I wanted to mention it.

Andras got one year server license IP for this package.

The second one I wanted to mention is Gianluca Zanferrari's package JavaScript HTML Table Excel Export. So what it does, it does an interesting thing that it takes a current HTML Table in the HTML Code and formats it in a way that it could be exported and used in Excel. In case of Internet Explorer, it also uses ActiveX control to even launch the Excel program. So if you want to allow users to edit HTML tables in Excel, that's the way to go.

Manuel Lemos: Yeah, actually, if you are not in Internet Explorer, it still will open file and make it open Excel, if you're on Windows or whatever is compliant in your platform.

OK, on my behalf, I also would like to talk about a few packages. Let me share the screen here. The first package that I wanted to comment is one that is interesting. Fortunately, I also have a demo, which basically is an analog clock. Well, the demo was supposed to appear here, but it doesn't. Maybe the author removed it.

Well, anyway, let's see if I can open the screen. Oh, it opens, but not when...

Arturs Sosins: Not like in IFrame?

Manuel Lemos: Inline, IFrame.

Well, anyway, as you may be able to see here, it's an analog clock. It just uses some CSS tricks to rotate the pointers, and it gives a nice effect.

OK, the next package that I wanted to comment is GPS2Country. This is very interesting because usually...

Sorry, I forgot to mention that the previous package was published by Suresh Kumar from India.

The next package that I wanted to mention, as I mentioned, is GPS2Country. It allows to determine the country at a given longitude and latitude. So it take the latitude and longitude. And this package by Dusan Boskic is able to determine if that coordinate is inside a given country. This all is done without creating a remote Web services. So it contains information about the boundaries of each country, and then it tells if a given coordinate is inside that country or not. So it was a great package.

JavaScript Innovation Award Rankings of 2015 (1:05:00)

Manuel Lemos: Now, let's take a look at the Innovation Award rankings so far for 2015. So far, Andras Toth is leading individually with 4 packages and 15 points, followed by Suresh Kumar with 3 packages and 10 points, then Gianluca Zanferrari with 1 package and 7 points.

Then, also with 7 points, Dusan Boskic. And then, there are several other authors with just 1 package but less points... Jackson Knowlton, Danish Satti, Mostafa Abd-El-Hamid, Diego La Monica, Stephen Chapman, and Arturs Sosins.


Manuel Lemos: Well, by country, this thing's actually more or less tied to who is leading because, unfortunately, JS Classes does not have many, many authors submitting packages, so many of them just represent their country all by themselves.

So in first place, there is Hungary with 4 packages and 15 points. Then, India with 3 packages and 10 points, Serbia with 2 packages and 7 points, Netherlands with 1 package and 7 points, and then United States with 2 packages and 7 points. I think United States is probably the only country that has more than one participant in this ranking.

Then, there is Italy (1 package and 4 points), Australia (1 package and 4 points), Egypt also 1 package and 4 points, Pakistan, also 1 package and 4 points, and Indonesia with 1 package and 3 points.

Well, we have had lots of contributions. JS Classes have been rising a lot this year, so we hope this competition becomes interesting.

PHP Innovation Award Winners of April 2015 (1:07:00)

Manuel Lemos: Now, let's move on to the Innovation Award of PHP, and for the month of April, we have lots of nominees. So we have to run to talk about these nominees.

They were voted in May. In June, the results come out. We are not complaining. It's a lot more to talk about these nominees, but it is good. It's still lot of package to comment, so let's try to do this very quickly.

Arturs, which ones would you like to comment?

Arturs Sosins: Sure, let me again share the screen, and here it is.

The first one I wanted to mention is Dave Smith. We talk about him a lot. Dave is from the United States. He developed the package, PHP Deprecated Function Checker. So, as we discussed, there are a lot of things getting deprecated in PHP, so it would be great to have your source analyzed, and this package does exactly that.

It takes your source code and parses it and determines if you're using any functions that are deprecated. And it even uses the list of deprecated function from external formats, so you can update it to the different PHP versions and test your code again, since it see if there's anything that might break.

And that's why basically I like the package. Dave got one downloadable copy of PHP ED Professional for this submission.

The next one, I also like, really, this package by Samuel Adeshina from Nigeria, and it's PHP Sentence Parser. What it does, it parses the simple sentences in PHP. It tries to interpret them, breaks them into words, and stuff like that, but most interesting part is that it tries to generate similar new sentence using different synonyms and other grammar-specific rules.

And so, you could use it in your website when you're reblogging to try to re-sentence, or code the same title in other words, so Google won't penalize you. That would be the great usage for this package, and that's why I like it.

Samuel got one copy of the Zend Studio for this package.

Manuel Lemos: OK, on my behalf, I also would like to comment a bunch of packages. I would start by this package by Abius X from Iran. He developed a parser for SQL queries. It is interesting because it can divide the queries into tokens that can be identified. And with that, it can analyze if two queries are similar and probably group them in a useful way.

For instance, I would see this package useful if you go through MySQL slow query, you could identify if certain queries that are being detected as slow are actually the same query with different values. Using this package, you could actually implement that solution.

For this, Abius X... I'm sure it's not his real name, it's probably an alias... got a prize which is SourceGuarding PHP encoder tool which is ...

Arturs Sosins: This is a new prize.

Manuel Lemos: It is a new prize, and it's already popular because many people want PHP encoders.

The next package that I want to comment is a package to manage users and groups of users for Windows Azure. Windows Azure is that cloud-hosting platform by Microsoft. This package was developed by Mostafa Abd-El-Hamid from Egypt. It is useful if you are using Windows Azure.

For this package, Mostafa got one subscription to the PDF edition of the PHP Architect magazine.

PHP Innovation Award Rankings of 2015 (1:12:04)

Manuel Lemos: So with this, it's time to take a look at the Innovation Award ranking of 2015. As we mentioned, this is becoming very, very competitive.

By author, Dave Smith is leading with 3 packages and 30 points. Dave is from the United States. An then, also from the United States is Matthew Knowlton with 2 packages and 27 points. Then, Ghali Ahmed with 3 packages and 26 points. Ghali is from Tunisia.

Dmitry Mamontov is from Russia ,and he has 2 packages and 23 points; Till Wehowski with 3 packages and 22 points; Dan Thanh from France, with 2 packages and 22 points. Alessio Felicioni is tied with also 2 packages and 22 points. He's from Italy.

André Liechti from Switzerland with 2 packages and 16 points, then Mohammed Al Ashaal, I think, from Egypt with 1 package and 16 points. And then, wapmorgan falls with 2 packages and 14 points.

So this ranking is very, very tight, because many people has been participating, which in turn is also making the ranking by country also very interesting.

So far, Russia is leading with 8 packages and 70 points, followed by United States with 6 packages and 62 points. Then, Germany also with 6 packages and 34 points, then Egypt with 3 packages and 28 points, France (3 packages and 26 points), then Tunisia also with 3 packages and 26 points.

Then, Italy (2 packages and 22 points), Nigeria, (2 packages and 20 points), Pakistan (2 packages and 19 points), and then Switzerland (2 packages and 16 points).

This is getting very, very competitive because the ranking by author is lead by two Americans, but that was not enough to pass Russia.

Arturs Sosins: Be in first place? Yeah.

Manuel Lemos: Yeah. So I think we will see very interesting developments in this ranking around this year.

This already takes in account the rankings of May. In June, we'll also have lots of packages that are still being voted. So let's see how these rankings will evolve.

Conclusion (1:15:06)

Manuel Lemos: So with this, we practically ended, reached this long podcast, and we'll continue to talk more about this interesting developments in PHP, as well as interesting articles, book reviews, and all these interesting packages next month.

So on my behalf, that is all for now. Bye.

Arturs Sosins: Bye.


You need to be a registered user or login to post a comment

1,614,003 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:


No comments were submitted yet.

  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Can PHP Run Faster as...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)