Laravel5 (PHP) or SailsJS (node.js)? - php

Actually, I am working on a project with Laravel5 (laravel.com)
someone who is working on another project with SailsJS (sailsjs.org) asked me why I am still using PHP. I should work with nodejs (sails), because PHP would be a language would be going to die.
Well, what's better to use for the future.
Both are MVC frameworks
on both you can code views with Jade (see jade-lang.org)
on both you can use any database.
on both you can easily install modules (composer / npm for the backend), bower for the frontend
What's better - and an important aspect - which framework creates responds faster?

As a technical guy, i would suggest you to use sails over laravel. Its not because PHP is going to die(and it will not happen).
As far as i know, anything built on javascript would be faster.
There are lot of advantages in sails like sockets are very easy to implement so on.
When it comes to disadvantage, its only with DOCUMENTATION. For a beginner, it would become little difficult to grasp all the things.
From PHP (Synchronous) to sails(Assynchronous), it will take some time to get familiar with sails.
Make sure you understand the basics of node.js very well before you start with sails.
For more references, see this , this and this

PHP is never going to die, Choosing a technology stack all depends on application & available resource, If you have expertise in php then you will obviously take longer time building app in nodejs/sails.
I have worked on both frameworks (sailsjs & larave 5.2) and for my new project i will go with laravel because:
Laravel is pretty mature framework (was founded in 2011 and has 9K contributors)
It got builtin support for most of things like migraters, seeders, queuing system and templates.
Documentation is very good.
lots of 3rd party integration, you can integrate it with s3-buckets, dropbox any email service provider and backup services in few minutes. complete list of integrations
Disadvantage of laravel:
Socket support is poor, but you can do socket part in nodejs, and can
bridge that using REST APIS.
Mongodb support is not good.

Related

What does scaffolding mean in Laravel 5?

I'm coming back to programming with Laravel by reading the documentation in the official website. Now I realized there is a 5.0 version and I'm trying it, but by I've noticed something called "scaffolding for user registration and authentication" and I don't understand it at all.
Maybe it's because my main language is Spanish and that word doesn't make sense for me in this context, but I'm really confused.
In the website, the paragraph says this:
Laravel ships with scaffolding for user registration and authentication. If you would like to remove this scaffolding, use the fresh Artisan command:
php artisan fresh
So I would like to know what does it exactly mean and what does it stand for.
The term Scaffolding roughly aims to a quickly set up skeleton for an app or your project.
The main purpose of Scaffolding is to speed your workflow rather than creating it new.
Here is the JeffreyWay/Laravel-4-Generators for your reference.
If you don't want you shall use php artisan fresh as you said in your question.
To get the generator back from your composer
composer require laracasts/generators --dev
Referring to my own answer in another question, I believe that Wikipedia provides a narrow and restricted view. Scaffolding is not just for CRUD operations on top of a database. Scaffolding has a broader objective to give you a skeleton app for any kind of technology.
Yeoman is a modern and useful tool for scaffolding. Using their own words:
The web's scaffolding tool for modern webapps
What's Yeoman?
Yeoman helps you to kickstart new projects, prescribing best practices
and tools to help you stay productive.
To do so, we provide a generator ecosystem. A generator is basically a
plugin that can be run with the yo command to scaffold complete
projects or useful parts.
Through our official Generators, we promote the "Yeoman workflow".
This workflow is a robust and opinionated client-side stack,
comprising tools and frameworks that can help developers quickly build
beautiful web applications. We take care of providing everything
needed to get started without any of the normal headaches associated
with a manual setup.
With a modular architecture that can scale out of the box, we leverage
the success and lessons learned from several open-source communities
to ensure the stack developers use is as intelligent as possible.
As firm believers in good documentation and well thought out build
processes, Yeoman includes support for linting, testing, minification
and much more, so developers can focus on solutions rather than
worrying about the little things.
That's it. Use scaffolding to create a quick-start application to work as an example or the foundation of your solution. It makes you productive faster them building things from scratch.

Which MongoDB library to use for a stand-alone PHP project with Symfony?

I am leading a new project where we're convinced that MongoDB is the right choice for database. We have decided that the architecture would be SOA, so the web part will be developed using Symfony and the service part will be developed using light-weight REST framework Tonic.
Now, in the service part, we'll be communicating with MongoDB and for that, we have looked into a number of available MongoDB libraries: Doctrine MongoDB ODM, Mondango, ActiveMongo, MongoRecord, etc. However, we are not sure which one to pick.
I was wondering if anyone can share their experience with these libraries so that we can make the right choice. Here are some of the properties we consider the library should have:
Plain PHP classes for defining documents (instead of array/config files)
Support for references
Efficiency in operations
Easy to understand API
Looking forward to your views!
Personally I would go with Doctrine2 ODM. Seen as you have already decided on Symfony as your framework for doing the heavy lifting the pair are well aligned as far as I understand. You should be able to use this https://github.com/doctrine/DoctrineMongoDBBundle to integrate the two pretty quickly.
The doctrine setup ticks all the boxes you've set for your project goals and is fairly easy to get working with. Most importantly, it's an active project so bug fixes/features/documentation updates happen fairly regularly.
We use a similar setup, except zend framework instead of Symfony, and we're very happy with the results.
Hope this helps.

Should I rewrite my Codeigniter/PHP app in Ruby on Rails? Why?

I already have v1 of my webapp written in Codeigniter/PHP.
I'm now working on v2, which will have some significant changes to all MVC components.
I'm pretty comfortable with CI and I like it. Very intuitive for a C coder like me.
But I am wondering if it is worth it to rewrite the app in Rails?
Will the productivity gains be worth the cost of learning another framework from scratch?
I want to be practical and not chase something just because it's cooler or more fun.
Here are some productivity criteria:
HTML and CSS generation is fairly labor intensive. Does Rails have anything distinctive to help with this?
I'd like to reuse other people's code for commonly implemented functionality (e.g. interfacing with FB, Twitter, and other social sites). How much more 3rd party code reuse would I get with Rails?
How much more benefit would I get from the Rails community vs. CI community?
Make automated testing easier. I test manually today, which is labor-intensive.
I'd appreciate specific benefits vs. idealistic/religious arguments.
Thanks!
Codeigniter is obviously a framework built on PHP. While there are fundamental differences between PHP and Ruby, all of your criteria can be met with either of the two languages. Migrating to Ruby would seem to be a waste of time considering your requirements. There are plenty of ways to automate HTML/CSS in PHP and there are numerous open source Facebook/Twitter integrations (just check FB and Twitter developer sections). There are also plenty of open source PHP testing options available. Google is your friend! IMO it would be a big waste of time to rewrite your entire application for the sake of your criteria when there are plenty of PHP solutions to your problem.
I think the better comparison here would be CI to Symfony. Symfony 1.4 is a PHP framework pretty much on par with Rails functionality - as far as I can tell through my research, anyway (I'm not a Ruby programmer).
If you were to switch to to Symfony, you would gain a lot of productivity tools. Symfony 1.4 + Doctrine has the ability to generate a lot of your code/interface for you. Symfony/Doctrine likes to keep you away from repetitive tasks such as building models and data validation.
If you want to do your research ahead of time, I suggest reading through Symfony's free e-book Piratical Symfony to give you an idea of how things work in Symfony.
Now, with all that said I feel obliged to mention that the Symfony team is working on Symfony 2.0 which will not be backwards compatible with Symfony 1.4. The expected release date is March of 2011. I expect that maintenance on Symfony 1.4 will continue in the future.
-- Edit --
I also think that sticking with your native language would allow you to develop with the least amount of overhead. Changing to a new language means having to learn it's up's and downs in order to be truly productive.
IE to be at a point where you're not coming back in 6 months to fix a bug that an experienced Ruby developer would have known to avoid.
To me, this is more a question of how big your current web app is. If it took you a couple of weekends and you do not have a tight deadline, I would switch to Ruby/Rails.
However, if it's significantly large and you actually want to come up with R2 in a timely fashion, I would suggest sticking with PHP.
As to your specific questions, I'm not too familiar with PHP, but I don't think Rails will give you a whole lot more in the HTML/CSS department. Not sure about the next two bullet points. Ruby does have much better automated testing tools, with new stuff coming out all the time.
Here are a couple links about Derek Sivers, who switched from PHP to Rails to PHP and now likes Rails again. It might help your thinking.
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
http://railstutorial.org/ruby-on-rails-tutorial-book#foreword

Do PHP Frameworks speed up the development process?

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.

Fastest / Easiest method to develop a multi-user gaming engine in PHP/MySQL?

I'm an advanced designer, but also starting out a career in development: I'm a PHP intermediate user. I (unfortunately) learnt procedural development, and not OOP.
My current project is a multi-user game web-app and I was developing procedurally only for my Boss to insist that it has to be OOP, so I needed to start learning OOP (I believe I am a relatively fast learner). A friend advised me to just learn a lightweight PHP framework and move on from there, since the project must be launched in less than three weeks (I have roughly 2 weeks left now)!
After viewing a lot of articles comparing them, I ended up with CodeIgniter, Kohana, and Yii based on the efficiency and the lightweight-edness. I am not quite used to command-line instructions like it's done in Yii, so I had to drop it off to save my time :(. Kohana looks very interesting, but I am new to the PHP5 and OOP it uses and there's VERY LITTLE help on Kohana, I even tried to buy books but there are none. CodeIgniter has a lot of helpful material, but it has no official Authentication module with Access Control, and the three open-source modules I have tested did not integrate well with other modules I am using.
Please can anyone recommend another OOP PHP framework with a quick learning curve, or provide some pointers to resolve the problems I had with those 3 frameworks tested, or should I just develop the entire application out of the box after studying OOP extensively? Thanks for your time.
There are frameworks, that provide an authentication natively but there is no way, that you can learn those in two weeks AND finish your project.
CodeIgniter was the first framework I learned and it was the perfect choice for me: The documentation is really good: reading the documentation enabled me to fully understand the MVC pattern. If I was in your position I would definitely use codeigniter and integrate one of the many free authentication plugins discussed here.
After you finished your project, you can go on and start learning symfony and Zend Framework, depending on your preferences.

Categories