Development Experience-experience in developing PHP frameworks

Source: Internet
Author: User
After reading Scholer's "Writing PHP now, You should know these", you can clearly distinguish the framework used by the job from the framework you like during development. Because I used the framework for development, database design, backend, front-end, and every time a new project starts, I had to re-design the database... after reading Scholer's "Writing PHP now, You should know these", you can clearly distinguish the framework used by the job from the framework you like during development. Because I used frameworks for development, database design, backend, and front-end, I had to re-design the database at the beginning of each new project, and the webpage had a long development cycle. The boss thought this was not good, it is necessary to develop a CMS to improve the reusability of the program. When selecting a framework, I am worried about the following:

  1. The customer's server version may still be 5.3.x.

  2. If the client server version is PHP5.3.X and is developed using yii2 or Laravel 4.2, it cannot be used on the client server.

At present, I am wandering between the frameworks Yii2 and Laravel 4.2. Because the PHP versions required by these two frameworks are both 5.4 or above, I am not sure to actually learn one of them. Thinkphp is not used for the moment because it is currently used by me and I just want to jump out of TP.

At present, I only know the database's RBAC and USER table design. The background RBAC can be reused. The corresponding functions should be re-coded based on the actual functions of the project.

I hope some friends can tell me some development suggestions. When using the framework, how should I improve the reusability of the program and avoid a new project, database design, background, reduce repeated operations on the foreground.

The first question is a bit nonsense. Please give me some advice.

Reply content:

After reading Scholer's "Writing PHP now, You should know these", you can clearly distinguish the framework used by the job from the framework you like during development. Because I used frameworks for development, database design, backend, and front-end, I had to re-design the database at the beginning of each new project, and the webpage had a long development cycle. The boss thought this was not good, it is necessary to develop a CMS to improve the reusability of the program. When selecting a framework, I am worried about the following:

  1. The customer's server version may still be 5.3.x.

  2. If the client server version is PHP5.3.X and is developed using yii2 or Laravel 4.2, it cannot be used on the client server.

At present, I am wandering between the frameworks Yii2 and Laravel 4.2. Because the PHP versions required by these two frameworks are both 5.4 or above, I am not sure to actually learn one of them. Thinkphp is not used for the moment because it is currently used by me and I just want to jump out of TP.

At present, I only know the database's RBAC and USER table design. The background RBAC can be reused. The corresponding functions should be re-coded based on the actual functions of the project.

I hope some friends can tell me some development suggestions. When using the framework, how should I improve the reusability of the program and avoid a new project, database design, background, reduce repeated operations on the foreground.

The first question is a bit nonsense. Please give me some advice.

What do you say ...... In fact, I was writing this article to discuss the problem with a friend. He asked me if I could componentize and hot plug some things. I said yes ...... Try composer ...... By accident, I have no intention of making such a title ...... However, such titles seem to be somewhat explosive ......

In fact, my original intention is to explain one thing: PHP is changing and there are many options. Don't look at wordpress or some frameworks based on the PHP4 era.

Many people have read phptherightway before and some have translated Modern PHP. In fact, my point of view is the same as that of the author: PHP is changing and is engaged in this line, do you also consider changing yourself?

As we used PHPMailer to send emails, many frameworks integrate swiftmailer. If you have used Laravel, do you want to study every dependent project in the vender? What other interesting things does the author of each dependent project do?

Of course, this is also because I am also engaged in server operations, so I never care about what the customer provides, because I am controllable and care about what I want to do.

What I want to do is what I choose and what I like. This is a job, but it is not just a task. I can have my own preferences, choices, and fun. So I prefer to know more and select the most appropriate one. This "fit" includes project maturity, ease of use, learning costs, and maintenance cycles.

These are the background. Let's talk about your problem.

Reuse

Composer is undoubtedly a means to reuse and simplify complex work with the power of open source. This concept is similar to pip and npm. It's just that the concept was proposed late (about 11 years or 12 years ?), So we are not so well-known. Develop some components and place them in public and private warehouses. composer and psr4 can help you solve the loading problem. Isn't it a good reuse?

Framework Selection

Laravel and yii2 are essentially the same, but their design concepts are very different. You can also look at some other frameworks, such as symfony and phalcon. There is always a challenge when you come into contact with something new. If there is a cost, you should mainly consider the project type (page-based or API? And front-end cooperation), how to choose? Depends on the benefits. If you do not understand the long-term benefits, you cannot make a choice.

Database Design

Database Design is actually a problem that is irrelevant to PHP and framework. If we talk about the relationship, let's look at it from two aspects:

  1. Preset data table/Data Relationship

  2. ORM or Model operations

If this question is too big, you can talk about design concepts, code organization methods, and so on. A little less: Can you get started quickly.

In actual development, it may take a long time for some developers to design a login registration module (some may be good at implementation, but not good at design ). Therefore, it may be easier to select some frameworks with preset basic data relationships.

As for the ORM and Model, the operation method of Eloquent is certainly different from that of CodeIgniter. There are many concepts of light: Active Record, data mapper, DAO (creating concepts to describe your own ideas may produce a greater sense of pride than the content itself ). You either don't need a framework, create a wheel, or follow the framework's thinking model, because the framework will inevitably have a combination of integration tools (or best practices ).

Background and Foreground

This problem is similar to the previous section. You probably know what advanced version yii2 has. You can tell me about frontend, backend, and so on. Is it difficult to do this? Not difficult. But what is important? A concept, or a design, or the following sentence: Some developers are good at implementation, but not good at design. The separation of the background front-end is based on two sets of frameworks, two different app directories in one set of frameworks, or a URI-based or domain name-based distinction. The matter itself is not important. The important thing is the cost.

In fact, what do I want to describe? You must have your own opinions, surveys, and preferences 』. Then you can try "practice 』. Engineers are not machines. It is normal to have their own preferences. Preferences do not conflict with work, just as business and technology do not conflict. How can we put our own ideas and preferences into practice and use technology to drive our business.

A little more.

Unlike the frontend, PHP seems to be thriving and thriving, with so many genres. However, PHP has never been immersed, and it has always had the traditional idea that it can work. A modern point of view is that Composer, dsrs, and even symfony routes have been written into comments, A little more advanced: C extension, PHP is a shelf (such a great God may have disdain for the Front ). This is also a manifestation of diversity and flexibility.

PHP is not the best language, not even a good language, but it is good for countless industry predecessors (such as laruence, such as nikic, PHP core development, it has also created excellent components such as FastRoute and PHP-Parser) and is trying to make it better. Trying their work results is also a contribution. Maybe you and I will be the beneficiaries in the end.

Why don't you stop using Thinkphp? If you want to jump out of tp and drop the pitfalls behind it, you can find a clear path.

Isn't OneThink a ready-made background based on ThinkPHP? Third-party ThinkCMFX, CoreThink, and ShuipFCMS.

I think the two of you are totally redundant. You can normally use these two frameworks for development. If the customer's PHP can only be deployed at 5.3, you may not be able to cope with the problem, modify the source code of these frameworks (both open-source and there is no worries), and make 5.3 adaptation. There are not many changes from 5.3 to 5.4, which can be easily adapted.

In addition:
ThinkPHP does have some drawbacks. It is not a bad thing to leave early. I think ThinkPHP's biggest risk is that it does not support Psr4 rules, which makes it difficult to introduce third-party libraries outside the system. This is why it is difficult to reuse programs between frameworks.

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.