📜 ⬆️ ⬇️

Why I chose Yii2

Translation of some chapters from the book of Bill Keck. Yii 2 For Beginners .

Foreword


Welcome to Yii2 for beginners. This book will guide you step by step through installation and deployment, and then programming to date the most exciting framework Yii2.

Yii2 comes in two versions, basic and advanced, and it may seem unnatural to use the advanced template for beginners, but this template, ironically, makes it easier to work with the application if it uses models that are stored in the database. Modern web applications need this functionality and the advanced template has at its disposal ready-made solutions for this.
')
Another great advantage of the advanced template is that the application is divided into frontend (user part) and backend (control module), which gives an exhaustive answer to the constantly emerging question: “where should I place the control module?”
I would like not only to introduce you to the wonderful world of the php framework, but also to give you a foothold that includes everything that a reliable, web-driven database application needs. Although the advanced template contains extremely useful features, there are, of course, missing important parts that we will replenish with the help of this book.

The goal is to provide you with a template model that you can use for all your future projects.

Opportunities


With the installation of the advanced template, you will get some of the features of the web application, including:



If something is not clear to you in this list, do not worry, we will reveal them in detail in the future. Just know - it is really amazing what Yii2 does for you. But the point is not how great this or that framework is, but how you all can support and develop it in a real application.

To do this, we will add to the application everything that is missing from the box:


This is all likely to be required for your application, regardless of who it will be like. Therefore, if you study Yii2 with the help of this book, you will be able to create a template that you can expand for all your future applications.

This book is ideal for novice programmers who are ready to go on developing with the help of the framework. Yii2 PHP framework is widely scalable and extensible, with built-in capabilities. We will introduce you to this amazing framework and explain in detail everything you need to know how to create and run. And you will love Yii2!

Advanced PHP experts will be able to quickly fly through the book and will be able to quickly create and run on the phenomenal Yii2 framework. That will allow not only to save them time at work, but also to use effective levers to benefit from the open source framework, which has a whole community behind it.

Nevertheless, the style of presentation in the book is designed for beginners. The book has a lot of detailed description to help people who have little experience with PHP and still can not really go into advanced object-oriented programming. We tried, of course, to fully explain how the framework works, how it uses OOP to create an intuitive level of development that would allow programmers of various levels to achieve the result to which they aspire.

In any case, studying Yii2 will give you experience with the PLO, with a practical result. You will complete the study of the book with a working web application.

What makes the Yii2 framework special?


Programmers must make a choice what will be the basis of programming. Therefore, one of the biggest decisions you need to make as a programmer, and, most likely, you will make a decision, as part of the programming team, whether to use the framework or not, and if so, which one.

Regarding the issue of using the PHP framework, there are so many advantages to do so that it becomes a no-brainer.

pros

Here are some obvious advantages of using a framework that:
- Uses standard problem solving techniques, which reduces or eliminates code entanglement.
- Reduces the time spent on routine tasks such as checking forms and security.
- Facilitates teamwork through adherence to standards.
- Facilitates code support using common architecture and methods.
- Has an active community of developers that support the framework, generalized tasks and new features.

Minuses

There are a couple of drawbacks to using the framework that should be noted. First, all the code that the framework includes creates a load on the server and this can be a real problem. Fortunately, caching options are available that reduce the impact of overloading, and for enterprise applications, you can use native SQL to minimize query execution time. Therefore, the problem of server overload should not stop you from using the framework.

Another thing, obviously, when you work with the framework, you work with a huge amount of code that you did not write, and you have to spend time to understand how it all works. Some parts of the code can be quite incomprehensible depending on your level of skill and experience, so you should not expect that you will understand everything immediately. This will not happen instantly.

Of course, you know that there is a way of learning, thanks to which you are currently reading this book. And although it takes time to deal with someone else's code, which can be painfully painful, but much more painful, to write your own user system from scratch. All things considered, using a framework for corporate development is a smart choice.

So, the simplest thing is to understand that using the framework will help you develop a more slender and reliable project, but now the most difficult. You have to decide which framework to use.

Why I chose Yii2


I cannot say which framework is the best for you, which is interesting for you and you personally decide, but I can tell you a little about the road that led me to Yii2. This was not a decision driven by the need to find an easy way to learn PHP, that’s for sure. In my company back in 2012, I was on the development team that looked at various frameworks and had to decide which one to use. At that time I did not even dream that I would write books about one of them.

In any case, we collectively explored everything we could find from the main PHP frameworks. I personally read all the documentation and we had many engineering discussions about what we thought would work. You can’t imagine my disappointment when I read all this documentation and walked away from it with a feeling less knowledgeable than I had before I started reading all this.

However, our team of programmers made a preference. They felt that Yii 1.1.14 was the best choice. It was a version of the framework that was available at the time, we chose it. Therefore, the team took this framework and never looked back. They loved her.
I, on the other hand, remained disappointed. Since I was just a novice programmer, and really struggled to learn this. I did not find this framework very intuitive and understandable. Especially after comparing it with other platforms, where we tried to integrate everything beautifully, and the architecture of Yii seemed to me just ugly.

I was so upset one day that I began to look for another option.

Other options


I wanted to find beautifully written documentation for the new framework and run it past the command. But he always got the same answer. The team was pleased with the framework Yii.

They told me that it might be difficult to study it, but it is easy to use as soon as you understand how it works. Therefore, I devoted myself to studying the framework chosen by the team. It was moving slowly and the ride was bumpy. I didn't enjoy it. I worked on chapter 10 in a book on Yii 1.1.14, believing that I would never truly be able to create an application myself in less than a hundred years. Too many roads seemed to go nowhere.

Then a miracle happened.

Appearance of yii2


I found Yii2 Alpha. I was curious to see what the differences were in Yii2, compared with the former 3 years at that time platform. So I dived into it and to my deep and complete surprise, I instantly got in touch with her. I understood the structure. I could write code that actually worked!

What a great feeling it was. I personally found that Yii 2 will be the most intuitive and elegant of all the PHP frameworks I have studied. I have so much enthusiasm that I want to share it, with every programmer I know, and even those whom I do not know, which prompted me to write this book.

With the help of Yii2, even being a newbie, I was able to get a working website, which had a database-driven user model, with a user and administrative part. Out of the box, I got a working user model, with a forgotten password recovery function, which is also integrated with bootstrapping for a mobile, responsive design, with no programming at all.

How great it is! Although I was a novice programmer when I was learning PHP frameworks, I had no experience working with databases and this is one of the areas, in my opinion, where Yii2 really shines.

Source: https://habr.com/ru/post/268269/


All Articles