PHP 7.0.0 Final has been Released
The PHP development team has announced the immediate availability of the much anticipated PHP 7.0.0, which brings PHP to version 7.
The PHP development team has announced the immediate availability of the much anticipated PHP 7.0.0, which brings PHP to version 7.
Changing the layout or template within a Zend Framework 2 is easy. Thanks to the layout controller plugin, one can change the layout for a given controller action in just one line. public function indexAction() { $this->layout(‘layout/default’); return new ViewModel(); } As you can see above, the only thing you have to do in order… read more
Getting the base url of a request in Zend Framework 2 is quite simple. Because you are probably extending the AbstractActionController class, you get some functionality out of the box, including easily accessing the current request. From the request, one can get the URI, which exposes various methods for different parts of the URI. In… read more
Accessing URL parameters from controllers in Zend Framework 2 is extremely easy thanks to the params controller plugin. This plugin exposes various methods that one can use to retrieve parameters from various sources of a request, including from the URL. I will give examples of the various sources below. Getting URL Parameters To get URL… read more
If you are using PostgreSQL with PHP’s PDO for database connectivity, you might have experienced that the lastInsertId method on the database handler returns FALSE after inserting a row into the database. This can cause a lot of frustration, and this is one of the scenarios where PDO is not so database vendor independent. For… read more
Creating a custom controller plugin in Zend Framework 2 is easy! First, begin by creating a new class. I will put this in the Application\Controller\Plugin namespace. namespace Application\Controller\Plugin; use Zend\Mvc\Controller\Plugin\AbstractPlugin; class HelloWorld extends AbstractPlugin { public function __invoke() { return $this->hello(); } public function hello() { return ‘Hello World!’; } } As you can see,… read more
While developing PHP applications with MAMP on OS X, it is very useful to be able to see errors being printed directly in the browser. By default, this is disabled with MAMP, but it is very easy to enable error reporting in MAMP. All you have to do is to follow the simple steps below.… read more
Generally speaking, view helpers should not be used within controllers, as the name suggests. Certain situations may, however, require one to do so. This article shows you just how to do that by fetching the view helper manager from the service manager. It is actually very simple. public function someAction() { $userData = ‘User data… read more
In a view script in Zend Framework 2, one may need to generate an URL for a given route that includes one or more query parameters. For instance, when browsing through a paginated data set, one may want a form’s action attribute to point to the current page, such that the user will end on… read more
As with any PHP extension, the mcrypt extension can be a bit tricky to install. This guide is meant to simplify this task, and most of the work will be done in the Terminal. Before beginning, please ensure that you have Xcode installed, which can be found in the App Store as well as the… read more