Development experience-PHP asks for some experience with framework development

Source: Internet
Author: User
After reading the Scholer "now write PHP, you should know these", only to understand the development, work using the framework and the framework you like can be separated. Because I used framework development, database design, backstage, front desk, each time a new project starts to do a database design, Web page, development cycle is long, the boss think this is not good, said need to develop a CMS, improve the reusability of the program. The current selection framework, I am worried about:

    1. The server version of the guest may still be in the 5.3.x version

    2. If the guest server version is php5.3.x, the project developed with YII2 or Laravel 4.2 cannot be used on the guest's server.

I am currently hovering between the two frameworks of Yii2 and Laravel 4.2, because both of the PHP versions required are 5.4 or above, so I am not afraid to real deal to learn one of these frameworks. Thinkphp is currently considering no longer used since this is what I am currently using, just want to jump out of TP.

Because I currently only know the database of the Rbac,user table design, the background of RBAC is reusable, the corresponding function, I will be based on the actual function of the project to re-code once.

Hope to have a friend can tell me some development suggestions, in the use of the framework, I should improve the reusability of the program, avoid a new project start, database design, backstage, the foreground will reduce the corresponding duplication of operations.

The first question, there is a lot of nonsense, but also please enlighten me.

Reply content:

After reading the Scholer "now write PHP, you should know these", only to understand the development, work using the framework and the framework you like can be separated. Because I used framework development, database design, backstage, front desk, each time a new project starts to do a database design, Web page, development cycle is long, the boss think this is not good, said need to develop a CMS, improve the reusability of the program. The current selection framework, I am worried about:

    1. The server version of the guest may still be in the 5.3.x version

    2. If the guest server version is php5.3.x, the project developed with YII2 or Laravel 4.2 cannot be used on the guest's server.

I am currently hovering between the two frameworks of Yii2 and Laravel 4.2, because both of the PHP versions required are 5.4 or above, so I am not afraid to real deal to learn one of these frameworks. Thinkphp is currently considering no longer used since this is what I am currently using, just want to jump out of TP.

Because I currently only know the database of the Rbac,user table design, the background of RBAC is reusable, the corresponding function, I will be based on the actual function of the project to re-code once.

Hope to have a friend can tell me some development suggestions, in the use of the framework, I should improve the reusability of the program, avoid a new project start, database design, backstage, the foreground will reduce the corresponding duplication of operations.

The first question, there is a lot of nonsense, but also please enlighten me.

How to say it ... In fact, when I was writing this to discuss with a friend, he asked me if I could put some things into a modular, hot-pluggable this, I said yes ... Try composer ... It was accidental, and I had no intention of making such a headline ... But the headlines seem to be exploding ...

In fact, my original intention is to explain one thing: PHP in the change, you can choose more, do not also take WordPress, or some based on the PHP4 era of the framework of the vision to see.

Before many people have seen Phptherightway, but also some people have translated "modern PHP" this book, in fact, my views and the author is consistent: PHP in the change, in this line, whether you also consider changing yourself?

Like the Phpmailer we used to send emails, many frameworks now integrate Swiftmailer. If you've ever used Laravel, do you have to look at each dependent project under vendor? What other interesting things did the author of each dependent project do?

Of course I say so, also because I can also engage in the server, so I always do not care what customers provide, because these I can control, care is what I want to do.

What I want to do, that's why I choose, what I like. This is a job, but not just the task, I can have my own preferences, my choice, but also to have fun. So I tend to know more and choose the most suitable one. This "fit" includes project maturity, ease of use, learning costs, maintenance cycles, and more.

These are in the background, say your question.

Reuse

Composer is undoubtedly the means of reusing and using the power of open source to simplify some complicated work. This idea is no different from Pip or NPM. It's just that the concept came up late (about 11 years or 12?). ), so it's not so high-profile right now. Is it not good reuse to develop components that are put into public and private warehouses, composer and PSR4 help you solve the problem of loading?

Frame selection

Laravel and Yii2 are much the same in nature, but there are very big differences in design concepts, and you can look at other frameworks, Symfony,phalcon and so on. Touch a new thing always meet the challenge, cost, mainly consider the project type (page-based or API?). and front-end cooperation, etc.), how to choose? Look at the benefits. If you can't read the long-term benefits, you can't make a choice.

Database design

Database design is itself an issue unrelated to PHP and the framework. If there is a relationship, do not think from two aspects:

    1. Preset data table/data relations

    2. ORM or Model mode of operation

This question is big can pull the design idea, the code organization way and so on, pull a small point is: can quickly get started.

In real development, even designing a login-registered module may be a long time for some developers (some may be good at it, but not good at design). So it might be a little easier to choose some frameworks that preset some basic data relationships.

As for the ORM and Model this piece, the simple example, the eloquent operation Way and the CodeIgniter certainly is different. There are many concepts of light: Active Record, Data Mapper, DAO (the idea of creating a concept to describe yourself may be more of a pride than the content itself). You either don't use the frame, or you build a wheel, or you follow the framework's thinking pattern, because the framework inevitably has a combination of integrated tools (or best practices).

Backstage, front desk

This question is actually similar to the previous paragraph, you probably know Yii2 has an advanced version, help you to divide the frontend, backend and so on. Is this a difficult thing to do? Not difficult. But what is important? A concept, or a design, or a phrase: Some developers are good at implementation, but not good at design. Background of the separation of the front desk, is to take two sets of frames, or a set of two different app directory, or design a URI-based or domain name, the matter itself is not important. It is important to realize the cost.

Actually speaking so much, what do I want to express? is to have their own "point of view", "research", "preferences." Then you can try hands-on "practice." An engineer is not a machine, it is normal to have his own preferences. Preferences and work do not conflict, just as business and technology do not conflict. Find ways to put their ideas and preferences into practice, using technology to drive business is what Wu bei should do.

Just a little more.

PHP is not like the front-end, now it seems to be thriving, thriving, there are so many genres. But PHP has not sunk, has always had the traditional view: can work on the line, a modern point of view: Composer, PSR, and even like symfony routes have been written in the comments, and then high-end: C extension, PHP is a shelf (this kind of great God may have more disdain for the front). This in itself is a manifestation of diversification and flexibility.

PHP is not the best language, not even a good language, but fortunately countless industry predecessors (such as Bird brother, such as nikic,php Core development, also created Fastroute, php-parser these excellent components) are trying to make it better, and try their labor results is a contribution, Maybe in the end you and I will be beneficiaries.

Why no longer use the thinkphp, want to jump out TP to the back of the pit people also refer to the Ming Road

Onethink is based on thinkphp off-the-shelf backstage? Third-party THINKCMFX, Corethink, shuipfcms these.

I think you two worry completely redundant, you can use these two framework development, if the deployment is really customer PHP only when 5.3, not big you according to the problem, modify the source of these frameworks (are open source, no worries), 5.3 of the adaptation can be. The changes from 5.3 to 5.4 are not much, and they can be easily adapted.

Other than that:
Thinkphp There are some drawbacks, it's not a bad thing you left early. I think the biggest hidden danger of thinkphp is the lack of support for PSR4 rules, which makes it difficult to introduce third-party libraries outside the system. This is why the program is difficult to reuse between frameworks.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.