Jump to content

What do you think about Laravel?


NotionCommotion

Recommended Posts

I've never used a 3rd party framework, and am thinking of trying one out.

 

Any recommendations on which one to try first?

 

What about Laravel?  Playing with it, and my initial concern is that it seems a little mystic regarding configuration.

 

Any recommended Laravel tutorials?  I am using https://laravel.com/docs/5.1/quickstart, and the database won't connect.  Looking at .env, I see the database credentials are not correct, and I suppose I set them here, but am concerned that this tutorial doesn't even address doing so.

Edited by NotionCommotion
Link to comment
Share on other sites

I just installed Laravel 5.3 (Current version) last night on Win7/Xammp. So far I am finding the official documentation much less than helpful. I had to go to a third party site just to figure out how to install it using composer.

 

So far, the tutorials I have found even for version < 5.3 differ from the current release.

Link to comment
Share on other sites

https://laravel.com/docs/5.1/quickstart ships with 5.2.20.  Note sure how much different it will be from 5.3.24.

[Michael@devserver laravel]$ php artisan --version
Laravel Framework version 5.3.24
[Michael@devserver laravel]$ cd ..
[Michael@devserver www]$ cd qu*
[Michael@devserver quickstart]$ php artisan --version
Laravel Framework version 5.2.20
[Michael@devserver quickstart]$
Link to comment
Share on other sites

I was not a fan of Laravel when I tried it, particularly with their facades thing. It made PHPStorm's helpful features about useless unless you installed some stub library to define all the facades. I found their Eloquent ORM system to be not as useful as Doctrine as well.

 

I was comparing Laravel side-by-side with Symfony at the time. Symfony won for me fairly early on so I never did get real far into Laravel. This was also a couple years ago (Symfony 2.x vs Laravel 4.x) so the experience is probably not as relevant.

 

I find with a lot of projects, particularly large ones, you generally have to be willing to dive into the code and figure things out rather than just rely solely on the documentation. Many times the documentation is missing some small details that you can find by digging into the code. That's one of the reasons I preferred symfony because it was easy to dig into the code by utilizing PHPStorms code navigation tools.

Link to comment
Share on other sites

@kicken I tried Laravel recently 5.3 and the same things that bugged you, still bug people. PHPStorm does not understand Laravel with all their facades.

 

They claim they love beautiful code but then go on to do something like:

https://laravel.com/docs/5.3/session#registering-the-driver

 

Create an entire new class to simply call a static method on another? Is this something we want to promote?

 

Their expressive interfaces are nice though. And it comes with a lot of functionality out of the box.

 

Where you would need quite a few bundles in Symfony to have the same functionality.

Edited by ignace
Link to comment
Share on other sites

I just finished the following 5.3 CRUD tutorial. It gave me a quick idea of how to do basic database operations. There was only one small error which is now noted in the page comments.

 

http://www.hc-kr.com/2016/10/laravel-5-crud-tutorial-ajax-bootstrap.html

 

I don't have any framework experience to compare with, but I am liking the migrations feature to create the DB and track changes along with rolling back to a previous schema.

 

I can see if you know how to use Laravel you could get something up and running pretty quickly.

Link to comment
Share on other sites

I just finished the following 5.3 CRUD tutorial. It gave me a quick idea of how to do basic database operations. There was only one small error which is now noted in the page comments.

 

http://www.hc-kr.com/2016/10/laravel-5-crud-tutorial-ajax-bootstrap.html

 

I don't have any framework experience to compare with, but I am liking the migrations feature to create the DB and track changes along with rolling back to a previous schema.

 

I can see if you know how to use Laravel you could get something up and running pretty quickly.

Hi Benanamen,  Did you get the following error?

"NetworkError: 404 Not Found - http://laravel.example.com/css/font-awesome.min.css"
Link to comment
Share on other sites

Yes. font-awesome.min.css is not part of bootstrap or Laravel. Either download it or use a CDN. I updated my comment on that tutorial page. 

 

CDN

https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css

 

I got down on Laravel Authorization yesterday. Super easy to do. Laravel does all the work. Here is the tutorial I used. It is just a couple commands.

 

 http://www.hc-kr.com/2016/09/laravel-5-authentication-login-registration-form.html

 

Moving on to Form to Email today.

Edited by benanamen
Link to comment
Share on other sites

Route groups allow you to share route attributes, such as middleware or namespaces, across a large number of routes without needing to define those attributes on each individual route. Shared attributes are specified in an array format as the first parameter to the Route::group method.

 

You can read about middleware here https://laravel.com/docs/5.3/middleware

 

As far as when I was doing the Auth, sending emails either locally or through Gmail was very, very simple.

Link to comment
Share on other sites

Thanks again benanamen,

 

Still a little confused.

 

Per https://laravel.com/docs/5.3/routing, I see two routes both which utilize the auth middleware.

Route::group(['middleware' => 'auth'], function () {
  Route::get('/', function () {
    // Uses Auth Middleware
  });

  Route::get('user/profile', function () {
    // Uses Auth Middleware
  });
});

I would like to compare this against the following. 

Route::group(['middleware' => ['web']], function() {
  Route::resource('blog','BlogController');
});

Because, middleware is set to an array ['web'] and not a string, all the following middleware is added to the route?  What if I also wanted the 'auth' middleware?

'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ]

And then I don't see individual routes, but understand that Route::resource() https://laravel.com/docs/5.3/controllers#resource-controllers makes 7 routes to the seven methods (index, create, store, show, edit, update,destroy) in BlogController for the particular http method.

 

Do I understand this correctly?

 

Link to comment
Share on other sites

Auth is really simple. There are only a few steps. Do this quick tutorial on Auth and see if it answers your questions. I am still learning this.

 

http://www.hc-kr.com/2016/09/laravel-5-authentication-login-registration-form.html

 

The Laracasts are really good, but were for a bit older version so some things are slightly different such as routes.php not existing in the current version. (Now routes/web.php). I suggest you just go through these videos step by step and then see if you are left with any questions at the end.

 

https://laracasts.com/series/laravel-5-from-scratch

Link to comment
Share on other sites

Turns out Route::group(['middleware' => ['web']], function() {}) and Route::group(['middleware' => web'], function() {}) are the same, and if more than one middleware are desired, one should use an array and pass both.  I expect that $middlewareGroups and $routeMiddleware are both searched and added as applicable.

 

Yea, Laravel does all the work and authorization is easy, however, it still seems a little magical to me.  I found it helpful to git the directory so I can see what files Laravel is changing when I do things such as php artisan make:auth.

Link to comment
Share on other sites

Yea, Laravel does all the work and authorization is easy, however, it still seems a little magical to me.  I found it helpful to git the directory so I can see what files Laravel is changing when I do things such as php artisan make:auth

 

For sure! I was thinking, "Is this all there is to Authentication?". I also am going to git for exactly the same reason. The more I study Laravel, the more I am liking it.

Edited by benanamen
Link to comment
Share on other sites

In the currrent version of Laravel Blade has changed a bit from what the tutorial on Layout Files shows at https://laracasts.com/series/laravel-5-from-scratch/episodes/5?autoplay=true

 

Take note of @show in the current version. Took me awhile to figure out there was changes from the video. Video instructions work, but again, not the current way of Blade Templating. Just reference the 5.3 docs here https://laravel.com/docs/5.3/blade

Link to comment
Share on other sites

 

Hi benanamen,

 

Have you had any success with setting up node.js per How to Manage Your CSS and JS

 

Doesn't work for me, and npm install results in the following error:

npm ERR! Error: No compatible version found: webpack@'>=2.1.0-beta.15 <=2.1.0--beta.22'

 

 

I just finished this video. I did not have this problem. Did you find out why you did?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.