B
B
BeZeer2016-04-07 16:11:26
git
BeZeer, 2016-04-07 16:11:26

How to develop a web project using yii2 as an example?

Hello!
I'm learning php and I want to do everything right at once. Now I'm getting acquainted with Yii2. I am writing my project. Usually, when working with cms, transferring to a working server is quite simple - transfer files via ftp, transfer the database and you're done. But what about complex projects, if you want to constantly add functionality and upload changes to the production server, but at the same time so that users do not have any failures, etc., and even more so data loss. As I understand it, migration will help not to lose data. But so far I haven’t really figured out with them, are they needed only for teamwork or should they be used in any case?
I would like experienced developers to point me in the right direction. How to properly develop a complex project, how to properly deploy. Interested in the algorithm and approaches. Develop on a local machine or raise a virtual server.
As an example, we made version 1.0, it is ready for release. How do we deploy first to some test server, and then to production? Suppose, then version 1.1 is ready, how to roll out the changes correctly?
I will be very grateful if you advise literature with the right approaches to developing web applications or describe your own experience.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Evgeny Bukharev, 2016-04-07
@evgenybuckharev

I have a project on a local server (git), then a dev version (git) and production on vps,
when uploading edits, I send everything to bitbucket from a local server, then through phing I merge edits from bitbucket to the dev version, I test if everything is ok , then through sssh using rsync I synchronize the dev version and production. As a result, there are only 2 commands to synchronize the local version with production, not taking into account the git commands.
On all three versions, the environment is also different, but everything is configured in such a way that the configs cling depending on where the project is located, if the local version is one, for dev and production, respectively, others

A
Alexander Litvinenko, 2016-04-07
@edli007

Let's try to help based on the problem. the first is this
Yii the first was exorbitantly good, in general there are a lot of "borrowed" things in PHP. Yii was first copied for the most part from Rails. But Yii2 is nowhere near as good as Yii1, it is already quite different from its predecessor.
Now Laravel is in the lead, for comparison, the usage statistics:
trends.builtwith.com/cms/Yii-Framework
trends.builtwith.com/framework/Laravel
Laravel is used six times more often. It is also "borrowed" in many ways, most of all it reminds me of Node.js, especially all these Request and routes point to the Node express framework, most likely it was taken from there.
To
And I’ll add “if a virus hits the site”, then Git is installed for this purpose, where code changes are clearly visible, and you correctly wrote about database mods, migration helps. Git and migrations are useful even without a command, it is not always possible to remember what has changed in the database structure, for example.
Also, among other things, I recommend figuring out what PHP can’t do normally, but in the frequency of WebSocket, this is one of the main nuances why PHP began to lose ground ( (Jap rating with chronology for the last 6 years) .
And also what PHP can do well, it is mainly to forgive mistakes and imperfections, for which business and beginners love him very much.

L
LAV45, 2016-04-16
@LAV45

Just on the Yii forum, this topic was discussed.
yiiframework.ru/forum/viewtopic.php?f=4&t=29291
I gave an example of uploading code to test and prod servers.
Dmytro Karpovych , I think you will be interested in this discussion.

D
Dmytro Karpovych, 2016-04-14
@ZAYEC77

Personally, I use git on the server and run commands via ssh to update the code and database.
There is a make-task for this:

deploy:
  ssh [email protected] -t 'cd /directory/of/project/; git pull; composer install; php yii modules-migrate --interactive=0'

modules-migrate is an analogue of the usual migrate, only for all modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question