Yii2 – What you need to know – Part V (Yii2 Application Structure, Security…)

Application Structure

In this last and final installment of the series on Yii2 and it’s new changes, we will take a quick look at all the additional details found in this update to the popular framework that are not covered in the previous parts. Yii2 Application Structure & Installation One of the things you will notice first while starting off development for Yii2 is the new and improved application structure and installation procedure. Yii2 uses composer from the get go to manage dependencies. Moreover, the Yii2 application structure is divided into two broad types: basic and advanced. The basic installation, creates a basic …

Continue Reading

Yii2 – What you need to know – Part IV (Events, Behaviors & Errors)

Events, Behaviors, Errors

In this installment of the series where we are exploring the Yii2 framework, we will look in detail at the Events, Behaviors and Error Handling features of the Yii2 framework. There are some notable differences in the way Yii2 handles these critical features when compared to how Yii used to handle them. Events For those of you that never used events in your previous Yii based projects, let me tell you, you have been missing a very powerful feature. Events are very useful for two reasons. First, they can make your components more flexible. Second, you can hook your own code into …

Continue Reading

Yii2 – What you need to know – Part III (Active Record)

Active Record

In this installment of the series where we are exploring the Yii2 framework, we will look in detail at the Active Record and database aspects of this powerful framework. We feel that this is one of the strongest sections of Yii2 in terms of both improvements as well as addition of new features. Database Support in the new Active Record class Among the big news in Yii2 Active Record is the support for numerous new backends including NoSQL based ones. These backends include elasticsearch, redis, Sphinx search as well as mongodb. This is great news as we can switch backends without …

Continue Reading

Yii2 – What you need to know – Part II (MVC)


MVC In part 2 of this series I am going to look at the core MVC concepts of the Yii2 framework. While the basic premise of the MVC structure of the Yii2 framework remains the same as that of Yii1.1, there are some subtle differences to be seen. As a result, when we delve deeper into the constructs of the MVC structure, we find a plethora of changes that will make development on the Yii2 platform a more rewarding experience. Models In Yii, Models extend from the yii\base\Model class. Models are typically used to both hold data and define the validation …

Continue Reading

Yii2 – What you need to know – Part I


Introduction to Yii2 The Yii project had started on  January 1, 2008, by some of the developers that were responsible for the PRADO framework. Their vision was to improve upon the PRADO framework and address all of it’s shortcomings. Yii 1.0 was formally released on December 3, 2008, and quickly became a major force in the huge ocean of PHP frameworks due to its performance, ease of use and adherence to some of the best practices of the industry at that time. Over time, as development on the PHP language itself picked up steam and new and more modern features got …

Continue Reading

Testing Bootstrap 4 on Yii2

Bootstrap 4 Yii2

For a Yii2 project I had taken up recently, we decided to go with bootstrap 4 although it was still in alpha development stage. Because, we reasoned, by the time the project was completed and released, Bootstrap 4 would have hit stable and we would find ourselves with an outdated library even before the release. In this post, I will take a look at how you can test your app using the latest bootstrap version. Yii2 Bootstrap Library Yii2 includes a crore bootstrap extension called yii2-bootstrap which can be found here: https://github.com/yiisoft/yii2-bootstrap. This is currently providing Bootstrap 3 and is at version …

Continue Reading

Install Laravel with Nginx and PHP-FPM

Install Laravel

Nginx with PHP-FPM is currently the preferred way to run PHP applications on your server. In this post, I will show you how to install Laravel on your server and run it on top of Nginx serving PHP files using PHP-FPM. We will also make use of composer as the preferred way to install Laravel. Install Laravel using Composer Make sure you have composer installed on your system. If not you can get it here. I would suggest you install composer globally. Once composer is installed and verified, you should setup the laravel installer using: This will create a new laravel …

Continue Reading

Angular2 and Yii2: Project Structure and Architecture

Angular2 and Yii2

How do you start off using Angular2 (or AngularJS) and Yii2 in a single project? What is a solid project structure / architecture that can be used to combine the two while still maintaining good separation of concerns? I will try to outline a basic folder structure and workflow I have used successfully in the past. Project Structure First of all let me show you the final directory structure that I am aiming for. Although I will explain how we get there in the next section, it is good to keep in mind what we are trying to achieve. The entire project is divided into two sections contained …

Continue Reading