Yes, I’ve not been very active around here. Christmas is coming up now and I’ve barely posted anything on this website this year, other than a few things back in Spring. I’m still working over ways to resolve my issues.

Recently, I’ve been having no end of trouble with Laravel. I’ve been using Laravel recently to develop Web Applications in place of Codeigniter, and it seems that Laravel isn’t the easiest thing in the world to update. Even a simple version update is causing huge problems, primarily if you try and import old packages.

In this case, Laravel 4.1 is supposedly out, but no packages I use with it work whatsoever. If I add any packages to it like so:

"require": {
"mpdf/mpdf"   : "dev-master"

Artisan FailThen, when running “composer update” in the command line, I get the error seen to the right.

This error has been driving me crazy. Many people have suggesting running “composer update –no-scripts” to skip running artisan scripts during the process, but that doesn’t work, either. The problem is, although artisan doesn’t output an error, there IS an error.

This is yet another problem I had. I could not for the life of me figure out what exact error artisan kept on throwing. Regardless, If I did run it and uploaded the files, I got this:

I've been stuck here for 38 turns. *tries again* ...still stuck...

I’ve been stuck here for 38 turns. *tries again* …still stuck…

At first I tried to simply use a simple pre-created laravel library. There’s a folder called app/libraries our application is using. I don’t think its a standard folder, but we have working libraries in there. But I tried to create a new simple library and laravel and it would not work no matter what I tried to do.

Discovering the Error

Figuring out what was wrong took an incredibly lengthy amount of time. I was comfortable developing with laravel, but dealing with things like composer and debugging errors related to the laravel core is what really drove me to insanity.

Everywhere I went I found nothing about the problems I was having. There were similar problems, but none of the things I tried worked. I went through numerous different issues, and even listed most of them up on the question I posted to Stack Overflow, which never got any responses either:

One of the answers I read seemed to indicate that it might be related to the packages I’m trying to import. I could’ve sworn I tried removing all of my packages and testing it out, but to no avail; nothing changed, I still got the same error as above when running composer update.

Laravel on PackagistNothing seemed to be wrong on Packagist, either. In fact, I was recommended to check out Packagist in the first place, which is how I got the idea to import the mPDF library in the first place.

I put these debugs on hold until the weekend when I started going over all my issues once more. I completely reinstalled laravel from scratch and tried again. Composer update was failing right out of the box. I had this same problem earlier in the week, so I even went through the process of completely reinstalling my XAMPP installation to no avail; I knew that wasn’t the problem.

What, then, was the issue? I had heard that some people had problems with certain packages, but I had no idea why said packages would cause any problems. I finally found this post:

The post explains everything perfectly. Some packages have different requirements. This time around, I tried again, removing all of my packages and making sure I ran “composer update –no-scripts.” I then ran “composer update” again. NO errors whatsoever.

I must’ve missed something on my first time through. Perhaps I missed adding “–no-scripts,” but that did it. Why, exactly, is laravel still not working right though? It refuses to accept any packages, even though I know I did successfully install packages on Laravel 4 before, primarily Ardent.

The only thing I can think of is that Laravel 4.1 isn’t fully supported yet, which is incompatible with Laravel 4.0. Whatever the case, it drove me insane trying to figure it out, and I never even did figure out how to get mPDF to actually work. But at least I got composer to update properly… at least that accounts for something.

Dealing With Laravel

When Laravel is working at top efficiency, it is extremely effective to use composer to bring in and install packages. I know I’ve gotten it working excellently before. But that doesn’t change the fact that this doesn’t always work the way you hope.

When installing, make sure that the scripts work correctly. If you get a script error, there might be an error that will crash your entire website as well. Take these things into consideration:

  • Have a backup before running “composer update.” (You should back up often anyway.)
  • If you’re saving your website into a repository, it may be helpful NOT to use the default .gitignore file; the vendor files may differ as does composer.lock. If composer update messes up your vendor files, you can back it up quickly by pushing your vendor and composer.lock which are ignored by default.
  • Watch each package carefully. Some packages may work, but others may have different requirements which will throw errors when running artisan and sometimes loading the entire website.
  • Make sure you have the current version of laravel correctly installed. I was missing several files and adjustments in my version of laravel and that caused initial problems early on. Laravel 4.1 requires additional changes that just running composer update, unfortunately.

So… with all these problems I’ve been having, is laravel still worth it? I think so. Its definitely worthwhile and easy to use once you get into working with it for a while. These kinds of issues only come up rarely, when you need to make updates or install packages. If you do have issues, once you resolve them you won’t have them again for a long while, so its a small detriment in the long run (despite being incredibly annoying for a time).