Use yii2 for production - php

it's about 6 months that the Yii2 preview (May 2013) was released. I think that in 6 months there are a lot bugs that were remove I would like to know it's a big risk for me to use yii2 for production. I would like to try my new project with Yii2. Are the people that use it for project with success? I understand that there are no extension at the moment. Most of time i dont use them !
thank for help))

Yes it's still risky to use yii2 for production, but there're some brave hearts who does it. For example I've heard this site is built with yii2. Also yii2 recently switched to php 5.4 and who knows what else will be changed. So, I would say it depends on your project requirements/strictness/complexity and time you're ready to spend for updating your code when something is changed in the framework. Also keep in mind that documentation isn't complete yet, and you'll have to look into source code quite often.

Related

Slim framework : upgrade from version 3 to version 4?

I've a slimframework v3 application that provide REST API for an Angular application.
I want to upgrade to v4, but there's quite a lot of changes and the upgrade page, while it mention what is changing, it's pretty dry on how to make those change and get a working application at the end.
For example, it says the new App() no longer takes the settings... ok... where does the settings go now ? Likely in the Dependency Container but this is changing too.
I fear that I will do a lot of code change and get a non working app and will spend ages on figuring out what's wrong.
So do you have any suggestion on how to proceed, step by step, to achieve a working upgrade from 3 to 4?
I've googled a bit, but I didn't find some walkthrough/tutorial on this subject.
I've managed to perform the upgrade.
It's way too long to document it here, so I've made a blog post here :
https://blog.mansonthomas.com/2019/11/upgrade-slimframework-v3-to-v4-how-i.html
I'll improve the article (readability & content)

PHP: Yii1 to Yii2 upgrade

I have a huge project written on a Yii1 framework. Now I have the task to port the whole project to Yii2. I know it's impossible to simply update the code and I have to do a lot of copy-paste-edit job.
But the Yii1 code is pretty proper and standardized, no spaghetti or something, and I wonder if people have some helpful tools to translate models, views and controllers from Yii1 to Yii2. How can I help myself to do it faster and automatize the process?
Yii1 and Yii2 have many things in common, but at the same time they are very different. There are no tools, converters, etc. to automate this process. You have to do it manually.
Please refer to official docs links mentioned in the comments:
Upgrading from version 1.1
Using Yii2 with Yii1
So, as an alternative you can try to do partial migration from Yii1 to Yii2.
Even Yii1 project code quality can be pretty high, it's not actively supported as Yii2, and its support will end at the end of 2016 year (as far as I remember).
Yii2 is so much better, so if you have possibility and time, it's better to migrate to Yii2. But if you have no plans to improve your project much (only implement small features, fix bugs, etc.), leaving it on first version seems like normal solution.

How to keep up with PHP Frameworks evolution?

So I'm about to start a big Property Management System for the cloud. This Hotel system already exists in VB.net technologies, and now we are porting the whole system to web.
We are trying to decide between ASP.net or PHP, we are thinking on PHP because ASP.net would cost too much on licensing and servers. So there is Laravel, Symphony, CodeIgniter, Zend, etc..
The thing is, this project is suppose to live for years to come. But we feel like getting constraint ed by using a PHP framework, because every time the framework gets updated then we need to update our whole system. For example.. now Laravel got updated from version 4 to 5. And the whole folder structure changed. I can't imagine having our big system needing to be updated and keep up to every Laravel version update. How do you keep up with this ?
Also, what would happened if Laravel disappears, its the trendy fashion now. But we see PHP frameworks come and go.
Would it be wiser not to use any php framework and building everything from scratch to have more control over it ?
You should first note that using a framework is primarily meant to solve two issues;
Force coding into a certain 'format'. Collaboratively working on code can generate 'hacked' solutions, or unmaintainable code. A framework can be the force which helps keep these things in check.
A framework comes with a certain core-code which handles for example database abstraction, routing, etc. which can save you a lot of time to develop yourself.
An extra thing to mention; when implementing new features, there is the possibility someone has built it before and maybe even better than you would have anticipated.
Keeping up with the framework should not be too hard, as long as you abide by the coding guidelines of the framework. With the bigger frameworks, new releases have (or after sometime generate) tutorials on how to port your previous version into the new version format.
Choosing which framework to use, is a question which is opinion-based and not suited to discuss here, but keep in mind that you choose your framework according to your needs. Also check how big the community is and how much 3rd party plugins/code exists (the more, the longer the framework will last).
Good luck!
You could see a framework as a base to start from. Remember that you get all the code! Look at the code. Do you like it? Does it fit your requirements? Using a framework gives you a huge advantage over making everything yourself from scratch.
But do you need to update? Would you update your own code constantly? Perhaps it's not always needed. Sure, if there is a security issue you should do something about it, but seeing every update to a framework as essential is just plain nonsense.
I build projects aimed at specific versions of frameworks and libraries. I try to build in flexibility so I can swap out frameworks and libraries, and versions, but I often find that I stick with what's working.
Some people might not like this, and argue you should always be on the latest version, but I find that completely impractical.

What's the fastest way to get started with Kohana PHP framework?

I have been reading that Kohana is good for my project. So now I want to get started. My PHP knowledge is 2 years old and very limited now. But I am experienced with object oriented programming and other patterns, since I develop in Objective-C. I know a little bit about databases.
People told me the Kohana documentation is horribly poor. So, where do I start as a newcommer?
this might not be the best way but
1. i watched the 2 tutorial videos on the codeignitor framework and tried a small example
2. i switched to kohana and tried the same thing and haven't looked back
i am quite familiar with php, so your mileage may vary
You'll definately want to start from the Kohana 101 wiki.
You may find it here.
As mentioned by petsagouris, the 101 wiki is a good resource for seeing examples of how to use the framework. It's also worth reading the docs as well. Even though they aren't as good as CI's they still contain a lot of useful information.
However if you want to get the most from the framework I recommend you invest a couple of hours looking through the code of the classes that you use (e.g. Kohana, ORM and if you're feeling brave, Database).
The files are very well documented and the experience will help you solve problems more quickly as you will know how Kohana works, and where to look if something isn't quite working as you expected.
If you want to avoid the pain of setting up the initial environment, I have released a vagrant dev environment with a base checkout of Kohana 3.3.1. Jumping right into the code is usually the best way to go. Hopefully this helps.
Intro to Vagrant with Kohana and Zen Kommerce

Which framework should I use to ensure better longterm upgrade / maintainability, CakePHP or CodeIgniter?

I am deciding on a framework to try out for PHP. I have narrowed it down to CakePHP and CodeIgniter. I have a couple of questions for any of you who have used or are familiar with both:
I like the fact that CakePHP keeps most of the code outside of the webroot by default. Especially since I may end up using a single framework install for multiple apps. I see CodeIgniter will do that too, but you have to configure it and move some stuff around. Is that workaround secure and reliable, or is it an afterthought hack?
Which (if not both) is easier to upgrade, and maintain over the long term? As new versions of the framework (and PHP itself) come out. I don't want to find my stuff either breaking, or becoming outdated.
Edit:
This is a very old post, but I thought I would update it with what I finally ended up doing, which was to use Kohana.
You should try both frameworks for a week or so, building something trivial (like a blog or wiki) in both, and see which you prefer using. Whatever makes the most sense to you will probably sustain you the longest through upgrades an deprecations.
CakePHP is in a bit of a volatile state right now, still unearthing bugs while pushing to release version 1.2 (which is not backward compatible). I wouldn't suggest building a critical application with it if you need something rock solid right now. If you can wait a month or two for things to settle, then it's probably a moot point.
To address your concerns:
1) Cake and CI do it the same way (iirc). They are equally secure, reliable, and hackish on this front.
2) Everything changes. If you need concrete, perpetual assurance of stability and backward compatibility, roll your own framework. There's not that much to it, and you're guaranteed that nothing changes unless you want it to.
I have deployed multiple applications on CakePHP and it's been a very, very, nice experience. You can't go wrong either way, as both are solid.
is a non-issue.
CodeIgniter has a sponsor behind it, so it's definately the one to choose for the long term. Also, it's faster.
This is a non issue. The app has a couple of lines which says where the core and your application code lies. You just need to change those lines.
You can never anticipate this one.
The state of PHP is a wildcard here. One app (CI) is built to be compatible with PHP4 the other requires PHP5. If you need to deal with the possibilty of a web host only supporting older versions of PHP then you need to go with CO.
Another issue is unit testing. If you require your framework to ship with tests, then CI is not the way to go.
Personally, I feel comfortable with CI because of the corporate backing. The company behind CI is making real profit from their efforts. Though CI is free, their paid product (ExpressionEngine) will eventually live on CI. The same could be said of the Zend Framework and even the birth of Rails (originally built for Basecamp.)
A minor correction to an above comment: both are compatible with PHP4, not just CI. Also, I don't think that having a sponsor makes CI and more or less upgradable or maintainable. Money doesn't solve those problems in the least.
I use CakePHP for a variety of applications and I've been happy with it thus far. 1.2 is a huge improvement over 1.1, and while the library source may change from RC3 to Final, I don't think any code you write will become obsolete. My only niggle is that the Manual isn't as comprehensive as it should be (in my opinion), and I end up in the API quite a bit. The trade-off there is that I now understand the code behind the scenes very well. In any case, I highly recommend it.
On the other hand, I've never played around with CI, so I can't recommend CakePHP over CI. I would take each for a spin and see which one grabs you. Whichever one you choose, study the hell out of its conventions and capabilities. When I started with Cake, I unwittingly wrote a bunch of code to do something Cake did "automagically" by having me set one variable in the controller.
CodeIgniter is very flexible as you would see once you try it. So how your application would be maintainable would fall you your hands.
I have also deployed multiple applications using the same installation. I usually create 2 applications for CMS projects (one for admin, one for the front-end).
To address both of your questions from a CodeIgniter perspective (I don't use Cake):
1) CodeIgniter doesn't keep itself outside the webroot by default, but it can do so with some very simple changes. The first part of my CI tutorial series explains how to do so, along with a walk through of the setup of a new CI instance. Once finished the only part of CI that needs to be in the webroot is a small index.php bootstrap file.
2) I've got an application which I originally developed in CI 1.4.x and I've sucessfully migrated to 1.5.x then 1.6.x. With each new release the CI dev's make available detailed upgrade instructions laying out what needs to be replaced so upgrades are fairly easy.
Jim.

Categories