PHP Directory


  • Understanding OpCache

    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%

  • Diffbot: Crawling with Visual Machine Learning

    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%

  • MVC – a Problem or a Solution?

    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?%

  • Bad conduct: the root of the problem

    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 […]
  • Using Guzzle with Twitter via Oauth

    In a previous article, we found out about Guzzle and how it can aid us in the task of establishing communication with third party API’s over HTTP. We used it to get the output of a random number generator and basic interaction with Github’s API. It also offers a series of ‘subscribers’, log-subscriber being one of them and showed us how easy it was to integrate monolog into it.

    While interacting with Github’s API we discovered that it supports basic authentication (sending plain username/password). But what if the API we want to use just offers OAUTH authentication?

    Guzzle’s Oauth

    Implementing OAUTH from scratch can be a hard and time consuming task, and would be like reinventing the wheel… You could grab a third party library to deal with OAUTH requests, but why do that when guzzle has its own OAUTH subscriber? Yay!

    First of all, I have to make you aware that Guzzle has dropped support for PHP 5.3, so you’ll need PHP 5.4 to follow this exercise. The installation instructions from the previous article changed a little bit, yet composer makes our lives a lot easier.

    Our goal is to interact with the Twitter API and get our own timeline for which ever purpose we need. We’ll begin with our composer.json file:

    Continue reading %Using Guzzle with Twitter via Oauth%

  • PHP Core Developers versus Facebook: Round 3 - The PHP Specification

    By Manuel Lemos
    Recently Facebook developers played on another episode of a saga that seems to antagonize Facebook and PHP Core developers.

    This time they announced an initiative to create a formal specification document for the PHP language.

    Read this article to learn more about this and previous episodes of this saga, and what this may mean for the PHP future.
  • Getting Started with ImpressPages

    Content management systems (CMSs) are among the most used web tools nowadays. Users range from designers and developers, to bloggers and project managers. However, even with a wide range of products on the market, users often neglect to try out new systems and experience new possibilities.

    To broaden my horizons, I decided to explore the market and see what other CMSs have to offer. This time I am going to look into ImpressPages, a PHP based CMS built on an MVC engine.

    What makes ImpressPages differ from other CMSs is code structure, customizability, the admin panel built on Bootstrap and an inline drag and drop editor. In this step-by-step tutorial, I am going to cover the very first steps of launching a website on ImpressPages.

    Downloading and Installing ImpressPages

    Download ImpressPages first. It’s important to check if your system meets all the requirements for running the CMS:

    • Apache server with “mod_rewrite” (adapt to Nginx as needed)
    • PHP 5.3.3 or newer;
    • PHP GD library;
    • PHP mbstring library;
    • PHP curl library;
    • PHP PDO library;
    • MySQL 5 and higher;
    • 30+ MB free disk space;
    • ini_set function enabled.

    After you create a database in MySQL which ImpressPages will use, unzip the contents of its archive into your web server’s root, or wherever you mean to serve it from, and run it (either via localhost, or through the virtual host you’ve set up, depending on your configuration). The installation process has been recently updated and now takes only two steps instead of six.


    After configuring your site information (website name, email and time zone), you will be automatically transferred to database installation. If your system doesn’t meet all the requirements, an error will be shown with information on what needs to be fixed.


    Once the installation is complete, you will be transferred straight to your new website. You’ll be be able to change the administrator’s credentials there.

    Continue reading %Getting Started with ImpressPages%

  • Functional Programming on Three Devs and a Maybe

  • PHP 5.5.15 is released

    The PHP Development Team announces the immediate availability of PHP 5.5.15. This release fixes several bugs against PHP 5.5.14. All PHP users are encouraged to upgrade to this new version.For source downloads of PHP 5.5.15, please visit our downloads page. Windows binaries can be found on The list of changes is recorded in the ChangeLog.
  • PHP 5.4.31 Released

    The PHP development team announces the immediate availability of PHP 5.4.31. Over 10 bugs were fixed in this release. All PHP 5.4 users are encouraged to upgrade to this version. For source downloads of PHP 5.4.31 please visit our downloads page, Windows binaries can be found on The list of changes is recorded in the ChangeLog.

:: Our Favorites

Featured Sites Using PHP

>Atlanta Real Estate