Running Laravel4 with PHP7

I will not argue about Laravel’s shitty versioning system and dropping support for older versions. They are so excited, everyday adding a new feature to framework’s core. Yeah, thats really good thing but who cares fucking backward compability?

Anyway, if you are using Laravel4 and want to run it with PHP7, you have make some changes on framework’s core. So, you need to fork L4 and publish it as a new package OR (preferred) you need to use it as custom repository.

So, what do you need to change?

Here is a pull request, that contains full change for support PHP7: https://github.com/laravel/framework/pull/13338

changed Exception object references to Throwable because PHP7 uses Error instead of Exception. So, referencing as Throwable is a good idea.

So what i did? Here: https://github.com/shibby/laravel-framework/commit/1ab51571fde84b31d7328e9b9c86033d390187bf

Just deleted Exception references on functions. I’m using my repository for projects that runs with PHP7. So, you can use it if you want with your own responsibility. And you have to watch security/critical fixes on Laravel’s 4.2 branch.

If you want to use this repository, you need to make some changes on your composer.json file.

First, i added "php":">="7.0", to my require section.

And, second, i added my repository as custom repository above require section:

"repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/shibby/laravel-framework.git"
    }
  ],

But i think i need to delete other branches on my fork for make composer’s resolution faster. I’m waiting for your ideas. Maybe we can move as a group? At last, i will upgrade my 4.2 project to latest(or lts) version. I want to do it with less pain. It hurts now :(

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *