Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tomicakorac's avatar

'Real Life' L5/L5.1 app example

Laracasts videos are obviously useful without a doubt. But I'm sure many will agree that nothing compares to a working example of a functional code.

Do any of you guys have an open source example of an already deployed L5/L5.1 app which you would like to show off? Being an example learner myself, I learn a lot by exploring examples rather than focusing on theory.

Things of particular interest would be:

  • Middleware;
  • Custom authentication methods (including third party packages);
  • Testing;
  • JS frameworks (such as Angular or Vue);

etc.

0 likes
34 replies
vedmant's avatar

Checked this "invoice-ninja" project, it's written mostly in a bad way, just look into routes file http://screencast.com/t/8EO1eFcZvJZ , they have put there tons of definitions, list of credits cards vendors http://screencast.com/t/hQtSfSTb , some functions. I would recommend not to get this project as an example of clear code. Also they never use Requests validations, while I was scrolling code I noticed tons of possible bugs, like using route resource on one function http://screencast.com/t/OFnqYW9Ame , they have to replace it with Route::post , and so on. Also this project don't use any custom Service providers, some wierd files http://screencast.com/t/oC1ImxfA1lh with wrong opening tag and not PhpDoc commets. Also they use Grunt, don't use elixir, all their JS is adder directly to public, while some others are build with Grunt from vendor that's also right in public folder. No any test PHPUnit test cases. So I don't recommend this project as an example.

1 like
tomicakorac's avatar

Thanks @all for the examples. I've seen LaraBin before and it's very useful. Thanks to Kryptonit3 from me as well. Although I was hoping to see a few more code bases.

tomicakorac's avatar

Thanks @Ruffles . I didn't know Laravel.io was available. It doesn't seem to be L5 though, but it's very useful nonetheless.

jimmck's avatar

As showing off someone's APP can be quite involved and the Laracast video's do not generally center on theory per say. I would suggest the following:

  1. Install a clean Laravel 5.1.
  2. Install a clean Laravel 5.0 in another directory.
  3. For some insane reason the base Authentication example is missing from 5.1
  4. Follow the upgrade instructions for 5.0 to 5.1. You will have to move code from 5.0 install to 5.1
  5. You can then see an example from soup to nuts.

You can use the theoretical video's to fill in some gaps.

jimmck's avatar

This will also give you practice in using Composer. Learn the Composer Fire Dance and show your tribute him/her. Composer will reward you by granting most update requests :} Don't be greedy and try to require too many packages at a time. Composer will reward you with the 'Red Screen of Confusion'!!! I recommend PHPStorm to code in. "Teach a Man to Fish..." Blah Blah... Typing code is good for the fingers and helps muscle memory...

1 like
tomicakorac's avatar

@jimmck I may still not be an artisan-level programmer, but I do know my way around building a basic small to middle sized app. I've learned all that thanks to tutorials from the most various sources around the Internet. I'm also pretty comfortable with Composer. But now I'm after just a bit bigger prey.

I like to compare programming with the game of chess, although you can compare literally anything you do with chess by the same analogy: The rules of chess are simple enough for anyone to learn them. It's very easy to learn which figure does what. But to become a true chess master, it takes exponentially more experience and real life practice.

Well, the same goes for PHP, in my opinion. I feel I'm on the border between knowing what all the functionality does and how it all works, and how to compose a beautiful symphony for that discorded orchestra.

And from my personal experience I know that there aren't many ways to learn that lesson. Except to have a first person encounter with as many good examples as possible. I think that's why Jeffrey also tries hard to show in his series real world examples that he's building. But no matter how useful his examples are, one person will always teach you less than two. And two people will teach you less than three people etc. So I just thought I'd ask for some more examples, namely about Events and Listeners, Middleware, managing multiple third party packages etc.

4 likes
keevitaja's avatar

This invoice-ninja is a worst example ever.

If it shows anything, then it would be "How to NOT write any application!"

1 like
jimmck's avatar

@tomicakorac I am in Awe of You Sir! You can learn by watching not doing! Bobby Fischer learned by playing countless games,of chess. But Watson, like you need only to be fed the input of others. In Awe Sir, I am truly humbled.

tomicakorac's avatar

@jimmck :D I couldn't agree with you more. My intention was never to just look at someone else's completed work and not do anything else. It's just that it isn't that easy for an inexperienced guy to presume how useful a piece of code is, as we've seen on the Invoice Ninja example after all. If it wasn't for all the guys' input, I would probably not have much doubt in that code, and would try following its example in my own work.

EDIT: My point is, you probably got me wrong if you think I could learn by just watching. It's actually on the contrary.

keevitaja's avatar

@polarcubs,

This code is not following a single solid principle, which makes it very hard to maintain.

https://github.com/hillelcoren/invoice-ninja/blob/master/app/Http/Controllers/InvoiceController.php

Controller should be a hub between user and framework. In this example the controller is the framework.

Also it is not using Laravel has it is intended to be used. Check routes.php . There some really weird define's in there. And it just one example of the weirdness of this project.

https://github.com/hillelcoren/invoice-ninja/blob/master/app/Http/routes.php

But everything above does not say that this cannot work. It is just a bad example on how to code Laravel app!

Edit: My goal is not to troll this project or it's creators. They have invested a great deal of their time into it.

vdhjonas's avatar

@tomicakorac I'm using middleware parameters and vue with laravel

It all works well, should clean it up a bit but I'm quite busy. I learned a whole lot from laracasts lessons over the year. In another private project I'm using Cartalyst Sentinel https://cartalyst.com/manual/sentinel/2.0 The only thing I have to do there is extend my User Model with their EloquentUser Model, same for Role model and it all works fine.

https://github.com/jonasvanderhaegen/jonasvanderhaegen.be/ http://j.mp/vdhjonas-todo

2 likes
davorminchorov's avatar

It looks like the whole app's code is only in the routes.php file :D

christopher's avatar

@martinbean sounds interesting :) But are you allowed to record voices from other people who doesnt know they are recorded? ^^

ZetecVan's avatar

In defence of the Invoice Ninja developer, (I am not he) he may have come from a procedural background. My first website developed with Codeigniter looked a lot like that, with duplicated code, and everything shoved in the controller or model because i had no idea where to put it.

Has anyone mentioned Laravel Tricks yet? https://github.com/CodepadME/laravel-tricks

EDIT: Oops. Laravel Tricks is a 4.1 site, not 5/5.1. Still worth looking at though.

1 like
Next

Please or to participate in this conversation.