Bruno Škvorc4 Features That Make Me Choose NuSphere PhpED (30.7.2014, 16:00 UTC)

In the last survey on the best PHP IDE for 2014, my longtime favorite PhpED was missing. I didn’t act on it then, but what better way to spread the love than to devote an article to it.

I’ve spent the first part of my programming career without a real IDE. UltraEdit was meeting most of my needs. At a certain point you start to realize you’re missing out on something and the quest for a real IDE begins.
For quite some time I was relatively happy with NetBeans; after some time though, I did find myself fighting it on too many occasions. I again concluded that it was time to move on. Having a historical hate for Eclipse (we had a serious misunderstanding back at version 3 dot something from which I still haven’t recovered) meant I had to test the commercial IDEs.

Why I chose PhpED

Speed, overview and simplicity. That sums it up, really. There are a few things that mattered for me, speed-wise; switching projects, getting code suggestions and fast debugging. Overview is something that I want because my projects get quite complex at times. An IDE like Eclipse overwhelms me with way too many options and buttons which I hardly ever use, keep it simple please. I believe I found my requirements and more in PhpED…

Project wizard

The project wizard will help you set up your project like you want it; simple local project, local server or remote server. Run on web server and/or CLI. Set up the directories, code page, PHP/HTML/CSS versions and finally checking to see if the debugger is working. It’ll be quite specific on how to fix issues or offer to fix them should there be any.



All the normal things are present when it comes to editing code: dynamic syntax highlighting for multiple languages, variable highlighting, fast searching and more. The code suggestion is instant; the IDE presents the possibilities that match the start that you typed. When you find what you wanted and your code is documented using PHPDoc, then it’ll show that while you’re entering your variables.


In the example above, you can perhaps spot something that can be improved; it fails to show multiline comments of the documentation. This is good to get a simple overview of the function call, but quite often you document something for a reason and you want to see it all.

Continue reading %4 Features That Make Me Choose NuSphere PhpED%

Lorna MitchellNew PHP Videos on (30.7.2014, 07:50 UTC)

I am delighted to announce that I have new video titles available! I'm delighted for two reasons: selfishly, because these things take a lot of prep and I am pleased they are done; but also because I think it is very good news that a key industry player such as O'Reilly recognises PHP's place in the world and works hard to publish new content in this area.

There are two videos available: PHP Web Services and Intermediate PHP (subtitle: a bunch of things Lorna thinks will make developers' lives and applications better!), you can click through (disclaimer: affiliate links!) to get more information and a detailed chapter outline for each course. I hope that either or both of them will be useful to you.

Intermediate PHP

Intermediate PHPThis video is a bit of a combination of ideas; really it's aimed at PHP developers who have been leading sheltered lives for a few years, or who are just now moving beyond the beginner stage (we all start sometime, is my firm belief). The course includes useful demonstration of modern tools such as Composer, and also old ones that often get overlooked such as the commandline, security features, and PDO - all of which I've included with some real-world-ish examples.

New features in the last few versions of PHP have been very object-oriented. If you've never studied OOP formally, or if you're just moving up from function-based programming (hello, lovely Drupal devs!), then I think it's really important to get a good grounding. This course therefore includes a light intro to PHP so that you know where you are, before moving on to showing off the shiny new things that have been added more recently. For developers looking to brush up in any of these areas, I've tried to create real, practical examples and the code is all on github too.

PHP Web Services

PHP Web ServicesThis isn't quite the video of the book, because PHP Web Services is a textbook and the video is more of a "hey, look what we can make!". Also since the book has been out more than a year, there are a few things that have changed and the video is bang up to date with the newer tools. Again, lots of example code and it's all on github so you can pause the video to make me stop talking and have a prod around at it all yourself :) I'm of the opinion that APIs need not be rocket science; they are within reach of every developer once you know what to do and how to do it! This course does just that, I've tried to let you "look over my shoulder" as I build basic versions of the APIs and integration code I work with on a regular basis.

Whether you are a books person or a videos person depends mostly on your learning style. I love to teach in-person, and videos give an opportunity to *show* you rather than *tell* you how I would do a particular thing. Hopefully one or other of these videos are useful to you, please let me know how you get on!

(O'Reilly do run occasional promotions on their content and they notify me when it includes my stuff - I'll be retweeting from @lornajane if that happens!)

Lorna is an independent web development consultant, author and trainer, available for work (interesting projects only). This post was originally published at LornaJane

Bruno ŠkvorcPHP News You May Have Missed – July 2014 (29.7.2014, 18:00 UTC)

A handful of news cropped up again that didn’t really get the attention they deserved, so I’ll use this opportunity to rehash some of them and explain others. The “news” here are usually less than brand new - instead, they’re bits of information you should pay attention to if you’re even the least bit interested in the PHP community and environment.

The Zend Rush

Zend, the company behind anything that has “Zend” in its name (Framework, Server, Studio, Engine…) has been very aggressive in product updates of late. They started the year off with a new release of their Zend Certification exam, continued with a huge update to the Zend Server, which we’ve covered in another post, and wrapped things up by updating Zend Studio to a new major version - it now goes to 11! We’ll be taking a more in-depth look at it in another post.

Continue reading %PHP News You May Have Missed – July 2014%

Ulf WendelPECL/mysqlnd_ms: how failed XA transactions get fixed (29.7.2014, 10:24 UTC)

XA transactions are an open standard for distributed transactions. A distributed or global transaction can spawn multiple databases. XA transactions come handy, for example, when data sets are sharded over multiple servers and a business transaction affects multiple shards. The free MySQL Fabric tools help to setup and manage a sharded MySQL cluster. The development version of PECL/mysqlnd_ms 1.6 helps with XA transactions. It abstracts SQL details and acts as a transaction manager. The PHP MySQL driver kicks in when things go wrong and XA transactions show their nasty side: blocked servers. Good news: this is a rare case. Bad news: a deep dive below.

Grant all Ulf’s a 10% discount (or none of them = use a transaction)
MySQL shard A: EMEA customers MySQL shard B: US customers MySQL shard C: APAC customers

/* Note: Fabric and XA don't go together - yet... it's coming! */
$link = 
new mysqli("mysql_sharding_cluster", "user", "password");

mysqlnd_ms_xa_begin($link, 1);

mysqlnd_ms_fabric_select_shard($link, "shop.customer", "EMEA");
$link->query("UPDATE discount = 10 WHERE first_name = 'Ulf');

mysqlnd_ms_fabric_select_shard($link, "shop.customer", "US");
$link->query("UPDATE discount = 10 WHERE first_name = 'Ulf');

mysqlnd_ms_fabric_select_shard($link, "shop.customer", "APAC");
$link->query("UPDATE discount = 10 WHERE first_name = 'Ulf');

mysqlnd_ms_xa_commit($link, 1);

PECL/mysqlnd_ms as a transaction manager

XA transactions use the two-phase commit protocol, which is a blocking protocol. Please, see also my previous blog post on the nature of the protocol and MySQL implementation limitation. If the client that drives the XA transaction, your PHP script, crashes at a certain point, some XA participants (MySQL servers) cannot make any progress. In the worst case, they end up waiting for a decision on the global transactions outcome endlessly. No, there is no timeout. As they wait, they block resources. That can be memory used for the transaction or some lock on some table.

Blocked during the second phase of the 2PC/XA protocol
PHP (coordinator) MySQL (participant) MySQL MySQL
–> Global commit  
  Comitted Uncomitted: waiting for global commit or rollback

Any serious user of XA transactions will therefore have to implement some mechanism that ensures progress in case of crashes. After a crash, it must be possible to learn which participant is blocked, connect to the participant and tell it to either commit or roll back the open transaction. This housekeeping job is rather annoying, yet important. PECL/mysqlnd_ms can do it for you, it can act as a transaction manager. (On an aside: the academic world does distinguish between a transaction manager and coordinator. I am using the terms interchangeably here.)

MySQL as a state store to track XA transactions

Upon request, PECL/mysqlnd_ms can record the state of each global transaction in a MySQL database. Should your PHP script (and with it PECL/mysqlnd_ms) crash or be interrupted in another way with an XA transaction being unfinished, then the next PHP script that runs can check the database and “garbage collect” the unfinished global transaction. The “next” PHP script could be run on the same server or another one, as long as all servers use the same MySQL database to track XA trans

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

thePHP.ccHHVM: The Alternative PHP Runtime (29.7.2014, 07:00 UTC)
Cal EvansInterview with Joel Clermont (29.7.2014, 05:00 UTC) Link
Bruno ŠkvorcUnderstanding OpCache (28.7.2014, 16:00 UTC)

The PHP in version 5.5 comes with a caching engine build-in - OpCache - which stores precompiled script bytecode in the memory. If you’re familiar with APC or Xcache, you will already know how such engines work. As each PHP script is being compiled at runtime, a part of the execution time gets used for transforming the human readable code into a code that can be understood by the machine. A bytecode cache engine like OpCache, APC or Xcache does it only once - during the first execution of a specific PHP file. Then the precompiled script is being stored in memory, which should lead to performance boost in your PHP applications.

Over the web you will easily find a lot of tutorials covering all the OpCache installation and configuration steps (it is enabled by default on 5.5, but can be installed as an extension on older versions). Read the article below to find the answers to some of the typical questions regarding different practical aspects of working with this particular cache engine.

1. Is OpCache worth installing at all? What speed boost can I expect?

Of course, it depends. If your server manages to handle the incoming traffic and keep low response times, you probably won’t feel the need to work on performance. But on a bigger website with a lot of traffic each little optimization step may count. Implementing OpCache may allow you to handle more requests per second and return the response quicker than without a bytecode caching engine. As OpCache is quite easy to install and configure, you won’t spend too much time on setting everything up.

Continue reading %Understanding OpCache%

Bruno ŠkvorcDiffbot: Crawling with Visual Machine Learning (27.7.2014, 18:00 UTC)

Have you ever wondered how social networks do URL previews so well when you share links? How do they know which images to grab, whom to cite as an author, or which tags to attach to the preview? Is it all crawling with complex regexes over source code? Actually, more often than not, it isn’t. Meta information defined in the source can be unreliable, and sites with less than stellar reputation often use them as keyword carriers, attempting to get search engines to rank them higher. Isn’t what we, the humans, see in front of us what matters anyway?

If you want to build a URL preview snippet or a news aggregator, there are many automatic crawlers available online, both proprietary and open source, but you seldom find something as niche as visual machine learning. This is exactly what Diffbot is - a “visual learning robot” which renders a URL you request in full and then visually extracts data, helping itself with some metadata from the page source as needed.

After covering some theory, in this post we’ll do a demo API call at one of SitePoint’s posts.

PHP Library

The PHP library for Diffbot is somewhat out of date, and as such we won’t be using it in this demo. We’ll be performing raw API calls, and in some future posts we’ll build our own library for API interaction.

If you’d like to take a look at the PHP library nonetheless, see here, and if you’re interested in libraries for other languages, Diffbot has a directory.

Continue reading %Diffbot: Crawling with Visual Machine Learning%

Bruno ŠkvorcMVC – a Problem or a Solution? (26.7.2014, 18:00 UTC)

Repositories, Adapters, MVC with all it cousins, SOLID, RTFM… As a (PHP) developer, those words are thrown at you from every corner of the web. And I hate it, I’ve had enough. Stop telling me what to do and show me those kittens instead.

Software solves problems

We don’t just write software. Code doesn’t fall out of the sky into our files. We analyze the requirements, split them into small problems we know how to solve, and then we solve those small problems. Every line of code you write, have written and will ever write solves a certain problem. Be it to save the world, show kittens on a screen or make it look good in IE8. It’s there for a reason, don’t you touch it!

Problems are solvable and the solutions for these problems become part of something bigger. A black box that satisfies all initial requirements. But how do we solve these problems? Is my solution the best solution? Will other developers (or me in 2 months) understand what I did here?

Continue reading %MVC – a Problem or a Solution?%

Anna FilinaBad conduct: the root of the problem (26.7.2014, 00:35 UTC)

More and more tech events are publishing codes of conduct. Although I think that it’s a good idea, I find it sad that we need to tell people things as basic as “treat others like you want to be treated”. I would like that in addition to treating the symptom, we understand and treat the root cause. Bad behavior incubates and spreads like a virus. We have a plague on our hands and we need to start controlling it!

Bad behavior existed since the dawn of man, but the Internet makes it easy to be offensive, mainly because the target is just a name or a profile picture. The interactions are less personal. Here are examples of bad behavior. I have personally been victim of ALL of these, as well as guilty of a few myself. Watch out for these both in others and in yourself.

Rape jokes

  • “Don’t drop the soap.”
  • “We totally raped your team.”
  • “He’d rape you if he knew that you listen to that singer.”

What’s really sad is that there’s no shortage of top ten lists.


  • Not leaving the person alone when asked to.
  • Directing derogatory comments at an individual. “You are an idiot.”
  • Using profane or indecent language, or make obscene suggestions. “He’ll stick his d*** up your a** if you say no.”

Yes, many insults are considered harassment by the law. As a side note, law exists to tell people how to behave in society, like telling people that they shouldn’t kill others, which is basically an expanded version of the ten commandments.

Intimidation and threat

  • “If you use that programming language, this is what will happen: (posts image of a person with a gun)”
  • “We’ll take your head off.”
  • Including partners, employers or clients in a disagreement to put the person’s livelihood at risk.
  • Suggest that harm may come to the person’s children.

Basically, if it can cause someone great discomfort, it’s intimidation. If it can cause fear, it’s a threat.


  • Spreading gossip and rumors with the intent of making others dislike or hate the person.
  • Posting material to intentionally defame or humiliate someone (e-mail with cc, blog posts, wikis, forum thread, etc.)
  • Vandalizing the person’s website, or websites that talk about that person.
  • Tweet trash about people without addressing them directly, but instead referring to them through mentions and links to their websites (exposing).

This is not limited to teenagers as you might think. Even CEOs sometimes engage in bullying. I’m not joking.

In the real world

Seeing others behave badly on the Internet makes such behavior seem acceptable, eventually making it seem acceptable offline. This got so out of hand that we need to explain to people that it’s not ok to use sexual imagery during a presentation at a tech conference. I even had a user group organizer draw his knife twice during a meeting because someone mispronounced his group’s name.

But what if the target did something wrong?

No. The reason is irrelevant. Nobody has the right to be the judge and executioner. If you see someone doing any of those things, no matter the reason, no matter what the other person did wrong, remind them that it is NOT acceptable behavior. They can’t solve a war with more rockets. That’s a great metaphor, use it. You can even post a link to this article.

Yes, you will be accused of tone policing and such, but you don’t need to reply. Anybody who thinks that the end justifies the means is just part of the problem. The silent witnesses of the thread already heard you. The seed has been planted. If some replies bother you, unsubscribe, ignore, block, stop notifications.

Will we succeed?

Everybody can make mistakes and correct them. If you want people to open their minds to criticism, call out their mistakes it in a non-threatening and non-humiliating way. People don’t respond well when their ego is attacked. Give them the benefit of the doubt to increase your “conversion rate”.

If enough people call out bad behavior, it will seem less okay. People will start to question themselves. Together, we will slowly tip the balance and eventually won’t need to explain the basics of respect on our websites.

Related read: On ethics and optimism.

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP