I currently have an application that is built w/ PHP/MySQL using the Laravel Framework. I want to migrate this application over to Ruby on Rails but I total teardown/rebuild is not feasible. I am wondering how easily it would be to have a PHP application and a Rails application coexisting together and slowly migrating the code over.
Has anyone out there attempted this? If so, what are some noteworthy things that might be of use to me?
There is nothing that comes to my mind that would stop you from doing this. As long as you are ensuring consistency in your database all the time it should not be a problem.
The most challenging task from my experience is to work around conventions in Rails, the naming of tables and columns for example. This is needed if you want to keep the database schema and it doesn't fit accidentally.
Related
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.
Here's the thing. I love Ruby and I've been using it for the past couple of years. I love everything about the language and the community.
But I have this soon-to-be-large WordPress site, where I have to implement a lot of additional functinality. The problem is, I really hate customizing WordPress beyond simple theme design.
Examples of things I need to do:
add some additional information to profiles, like karma/points/reputation system
offer users to create their own page after they're allowed to do it
pulling data from some external API and displaying it on the user's profile
I got really used to the whole agile BDD workflow, where I go from Cucumber features to RSpec to implementing the stuff, and the whole WordPress architecture looks to me like ok I'm just gonna have to pray this works.
I'm not sure if it's even wise to try to write some part of the app in Ruby and try to make it work together with WordPress, or if I should just take WordPress as the only thing I've got and make the most of it's strenghts and weaknesses.
The main issue for me is that everything I'm going to write in PHP will take about 5 times as long than if I do it in Ruby, and it will probably also be more secure and robust, since I don't have as much experience with complex PHP stuff. I mean I've done a lot of PHP in the past, but I always felt like the whole thing is going to fall apart at one point.
I know there is probably no definite answer on how to approach this, but any suggestions are welcome.
We've integrated a Rails app into a TYPO3 installation. It worked out pretty well. The key point is to use Rails' support for adapting models to tables of a legacy app. An important point is to handle authentication which we handle by passing the TYPO3 session key to the Rails app in a hidden way (using PHP as the web-client and passing appropriate headers) and looking it up in the session table (respecting the session timeouts). The Rails app itself is mapped into a sub directory using passenger. Performance is very good, it's even amazing compared to our previous implementation trying to use Extbase.
So, in conclusion: If you do it right and the interfaces between the two apps are well planned such an approach can offer great benefits and the best of two worlds. If not done right or you don't understand some implications of Wordpress (like security) you will create a big mess prone to security breaches.
BTW: We reached feature parity with the Extbase (MVC framework in TYPO3) solution after 4 days of using Rails. The Extbase solution took 6 weeeks and caused a lot of headache and trouble. So your time factor may be even better than 5:1.
Why not learn how to to Behavior Driven Development in PHP for WordPress? In fact, this is one of the great opportunities for developers in 2017. We now how full blown BDD frameworks in WP-Codeception, so that you can even automate Gherkin feature files, just like in Cucumber. Check out WordPress-BDD.com for some usefull info.
I'm working on a project using Zend Framework, which I initially chose since I had a bit more experience in it. At this point in time, I'm thinking of moving to Django, though, as our current team will be more productive in it.
I'm trying to figure out the best way to (potentially) go about this, as we evaluate it. A lot of our code is still fairly fluid, and being re-written fairly often. The way I had considered is that as something ends up being re-done, redo it in Django, and change my PHP model to simply be a call to the Django underbelly and translation to PHP. Over time, we should have all of the models, at least, in Django.
Are there better ways? Particularly, is there any way to easily manage having two codebases at once?
There is no generic answer to cross-language migration projects.
If you can wrap your php code and hide it behind web services, you will be on a good path because you will be able to migrate those web services later without changing the API.
Make a list of the main components of your architecture and try to see which ones could be hidden behind such a web service API.
I would recommend that if your web app is db driven, move your business logic to your db and have your data mappers call db stored procedures. I'm developing using ZF myself, which is a very strong tool, but the immense 'abstracticity' it offers can deviate you from your goals... Then you can mess as much as you like with your controllers and views...
I recently started working for a web firm as a freelancer, taking my hobby of coding in PHP to a career level, and since then I have been overwhelmed by the amount of work that needs to be done within short time frames.
The problem isn’t being able to do what is asked, but being able to do it all as quickly as is needed of me. I never used any PHP frameworks, but if I started using one, would that speed up the entire development process? If so, how drastically?
Also which framework would be best for my purpose?
If it matters, what I do is mostly build back end CMSs and tie that in with front end functionality for small business client sites.
Once you know a Framework well (i.e. don't have to spend time learning how to use it), yes, it helps speed up both :
The development process
The maintenance process
Why ? Well, probably, at least, because :
It provides guidelines
No need to think (too much) about what goes where, or how to do X or Y
Those guidelines are known by everyone who knows the framework -- which means you can hire a guy that knows the framework, and he'll need less time to be efficient on your project
It provides a lot of useful libraries
which means less time spent re-inventing the wheel
and components that are already integrated in/with the framework ; which makes it easier to use them from your application than some random external component
Now, for the "which framework should I use" part... it's mostly a matter of personnal preferences, and there are many existing questions about that on SO.
To only give you a few links, you can start taking a look at questions+answers such as :
PHP Framework Decision - Analysis paralysis!
What PHP framework would you choose for a new application and why?
To use a PHP framework or not?
PHP - MVC framework?
Which PHP Framework is right for this project?
Best PHP framework for an experienced PHP developer?
And there are many others -- you can use the search box, in the upper-right corner of the site, to find more ;-)
They certainly do.
Something to be aware of is there are variable learning curves depending on the framework that you decide upon. So you might experience slower development initially while getting comfortable in a new environment.
I have seen the zend framework recommended may times.
firstly if you go to phpframeworks you can view exactly what kind of framework would fit your work load.
next, frameworks initially take time to implement corectly, but once everything is done, it speeds up considerably your development time for your projects. However what's nice about this is that if your framework is done correctly you can apply it to all your projects. Where I work currently we have a framework that is implemented and it applies to all the sites that are being developed. if you want each project to have the same type of look and feel and functionality then a framework is your best bet
however if it's just for one project it might be a little too much.
I have been dabbling in programming/scripting languages since I was a kid. I started off with HTML and CSS, then went on to PHP (which I got quite good at) and then to Python, Perl, and C(++). I've recently done a lot of work in PHP (along with MySQL).
After spending so much time learning these languages, I now want to do something with them. I'm looking at starting/contributing to an open source project; almost certainly a web application of some sort.
In my experience with writing (admittedly small) web applications, I've found writing "pure" PHP to be an extremely slow and tedious process.
My question is this: if I were to be writing a relatively complex/large web application from scratch, what should I write it in? Should I use pure PHP/MySQL, or use a framework like Django, Rails, or CakePHP?
Writing a complex application from scratch, I would definitly not use "bare PHP" : I would certainly use a framework : they provide :
a large number of useful classes/methods
some set of rules -- like "in which directory should controllers be saved", "how to write a view", ...
MVC -- i.e. they help with better structuration of the project
Note that this answer is valid for both personnal projects, and professionnal projects.
There are several great Frameworks in PHP, like :
Zend Framework
Symfony
CakePHP
Code Igniter
Kohana
One thing to remember : learning how to use a framework well will take some time : starting with a small project, before going for a big one, would probably be a good idea ;-)
Now, when you're asking yourself the question of "which framework should I choose", it's mostly a matter of personnal preferences... And here are a couple of questions/answers that might help a bit :
PHP Framework Decision - Analysis paralysis!
To use a PHP framework or not?
PHP - MVC framework?
Which PHP Framework is right for this project?
Best PHP framework for an experienced PHP developer?
As you're asking me which Framework I would choose ; well :
I really like Zend Framework, and often use Doctrine as ORM (it's the default ORM of Symfony, but can be used very easily with ZF)
If I had to choose another one, I would probably go with Symfony, as I've seen it used on a couple of projects at work, and know many people who work with it and like it
If you already know that language, you should most definitely use a framework (unless you're a masochist).
For me, besides that fact that they're usually bundled with all sorts of great libraries, using a framework is all about using time effectively.
Most importantly, it will save you time. You're freed from the nitty-gritty of worrying about the foundation/architecture and are able to spend your time of the features of the application itself.
Also, it will save others time; especially since you plan on being all open sourcey.
depending of your skills level, yes you can do it in pure PHP without frameworks. This also will be good, IMO, to improve your skills at debugging, logics, and others. But, on the other hand, you will restrict to other programmers to improve/maintain your code due to learning curve, in this case, the framework serves as a commom language. I recommend that if your project will be complex, or with the possiblity to other programmers join in the project, that you choose a framework which you feels comfortable and use it.
Depends on who will be working with the code, on which plattform it has to run and how complex the database should be.
If you develop for a company or community it is always easiest to use PHP because there are many others who know it so i.e. for companies it's easier to recruit someone who knows the language.
If you mostly want to develop on your own, use what you like most, i even heard of websites written in pure common lisp.
If the application can run on windows only C# is also a good solution as you can develop web applications extremely fast and the .NET library makes many tasks easy.
As database backend you can use MySQL if the structure is simple but for more complex databases i'd use postgres as the MySQL performance seems to drop fast with increasing complexity (subjective opinion).
EDIT:
As others noted, Frameworks are always a good idea. There are web frameworks for most of the current languages. For PHP CakePHP was recently recommended to me.