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

MThomas's avatar

Development in Laravel 5, best practices

Today I noticed that Taylor made some changes to the default service providers.

As from the start of the Laravel 5 series here on Laracast I switched over development of a new project to Laravel 5 ( I read that Jeffrey himeself is also developing in Laravel 5 atm).

That things might break during this phase I know, L5 is still in development. But how to handle changes like today: https://github.com/laravel/laravel/commit/e700cd710effa2f6f0146ed1295edb5f854f0a19

How do you guys handle this? Track these kind of changes without missing out on the new 'fixes' or copying your own code in a fresh laravel install regularly??

0 likes
23 replies
MThomas's avatar

@slider23 As mentioned in my post in the comments of one of the lessons jeffery mentioned that he himself is currently using Laravel 5 for development. So I know there are risks in using it before the RC, but still I'am clearly not the only one using it at this point in time, so more people will bump into this (and probably similar) problem.

1 like
VerifiablyMrWonka's avatar

You could, assuming you're using git, bring the laravel/laravel repo in as a remote and rebase all of your changes on it. That way keeping up to date is as simple as doing a pull and fixing any merge issues.

VerifiablyMrWonka's avatar

I'm not super up to date on the command line usage as I'm a layabout GUI user (Sourcetree in this case, it's free and multiplatform) but I think the general gist is:

git remote add upstream https://github.com/laravel/laravel.git
git rebase upstream/develop

-- merge conflicts
-- fix them
-- commit fixed files

git rebase --continue

--- repeat until done.

Like I said I'm not a big git command line user so this may blow things up horribly. Please keep a backup before trying these and ensure you read the documentation for git thoroughly.

1 like
bashy's avatar

You can always just change stuff like that yourself (/app files).

I'm developing on it too (nothing major but testing the new L5 stuff is good practise). Not had many big problems with updates, just make sure to watch the changes

1 like
MThomas's avatar

@bashy, So your advise would be to check the repo regularly on changes and applying those changes manually?

bashy's avatar

If you don't want to setup the git to pull in changes, yes. There's been a few changes in /app files.

MThomas's avatar

@bashy, and how would you suggest doing that? I tried @VerifiablyMrWonka in a git bash terminal, but that did not work. Using Sourcetree would be an option, but my git knowledge is lacking on this part. I have no idea how to check/merge an upstream repo.

bashy's avatar

It's probably not worth it, most of the changes are just name changes or namespaces. If you get an error upon doing an update, check the framework and laravel git repos and see for any issues and changes. Then just adjust it to your copy.

Erik's avatar

Me personally, I just update the laravel/laravel manually. And for the laravel/framework just composer update.

Valorin's avatar
Valorin
Best Answer
Level 4

I keep a clean local copy of laravel/laravel which is tracking to the develop branch. Then when I'm ready to update my L5 application, I run a git pull, and it tells me all of the modified files. Then I copy each file over into my application, use git to review the changes and manually merge them. While that's happening, I do a composer update to update the framework.

The important things are that I do this every few days, so the changes don't pile up - smaller changes are a lot simpler to merge, and I only update via composer when updating the application. They need to stay in sync.

If it help, the git commands I use to set it up are:

git clone https://github.com/laravel/laravel.git
cd laravel/
git checkout develop 

Then when I'm ready to update:

valorin@aragorn:~/workspace/laravel> git pull
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 17 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (17/17), done.
From https://github.com/laravel/laravel
   2889a26..0a45098 develop -> origin/develop
Updating 2889a26..0a45098
Fast-forward
 app/Providers/EventServiceProvider.php | 19 +++++++++++++++++++
 app/Providers/FilterServiceProvider.php | 2 +-
 app/Providers/RouteServiceProvider.php | 2 +-
 config/app.php | 1 +
 resources/assets/.gitkeep | 0
 5 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 app/Providers/EventServiceProvider.php
 create mode 100644 resources/assets/.gitkeep

Note in the git pull output it lists 5 modified files. These are the only ones we need to worry about updating in our application.

3 likes
MThomas's avatar

@Valorin, that sounds like an interesing and easy to use solution! Thanks for the info!

1 like
unitedworx's avatar

A similar visual approach without git is

Keep untouched laravel 5 in a folder once you start working with it. ( laravel/laravel not the framework) https://github.com/laravel/laravel/archive/develop.zip

Now a month or weeks later if you want to make sure you haven't missed anything then downloading it again and store it in another folder (its probably a good idea to timestamp the folders)

Then compare the 2 folders using a tool such as kaleidoscope (http://www.kaleidoscopeapp.com) or delta walker (http://www.deltopia.com/compare-merge-sync/macosx/)

Once you see the changes in there then you will need to make sure to manually pass them on to your laravel 5 project

It's a nice visual way to compare what was changed in laravel 5 and make sure you are up to speed. http://cl.ly/image/400s0N221v3A

clevonnoel's avatar

I just update the app manually. Usually its small changes

dgbrunoh's avatar

Hi @MThomas, this discussion help me a lot, your ideia is great @Valorin :) ... I just improve one thing, I add to my "l5-dev-project" a remote path to the "fresh-laravel-project" when a new commit out in "fresh" project I just pull it and merge with my "l5-dev-project"

basically:

git remote add fresh_laravel https://github.com/laravel/laravel.git
git pull fresh_laravel develop

I hope it help :D

JeffreyWay's avatar

Just to clarify (in response to the original question), I'm not using Laravel 5 anywhere in production. That would be suicide. :)

1 like
slovenianGooner's avatar

I more or less check the commits on Github every day and update what's needed. Mostly it's one or two files so it's not an issue. I have an app pretty much developed for L5 and mostly it works without a problem. It's not production ready, but it will be when L5 is released.

MThomas's avatar

@slovenianGooner, that is what I do myself at the moment (after this thread started 2 weeks ago haha).

@JeffreyWay, that would be suicide indeed, but I was sure I read a comment of you somewere stating that you are developing in it atm.

pmall's avatar

@JeffreyWay why not an official thread to keep track of the tricks we have to do to keep L5 working ? Like keeping the bootstrap/paths.php file. We are a lot to use L5 I think it would be useful to centralize these info.

MThomas's avatar

@pmall, I think that would not be doable, there are so many changes made to the framework that it is very hard to keep an list of tricks to keep it working. Most of the time it is a temporary fix and a couple of hours or days later the issue is fixed by Taylor in a new commit.

Thats the 'fun' of working with an unstable under high development framework :)

1 like
matiascx's avatar

I address this upgrading with following process:

  1. git clone https://github.com/laravel/laravel.git myporject
  2. composer install
  3. git remote remove origin
  4. git remote add myorigin https://github.com/myaccount/myproject
  5. git push myorigin master;
  6. based on that fresh project, i do development job;
  7. say some months passed, i'd like to upgrade laravel to latest stable, i do so: 8.a: git remote add laravel https://github.com/laravel/laravel.git 8.b: git fetch laravel master 8.c: git merge laravel/master 8.d: composer update
  8. git push myorigin master From now on, i will have the latest stable laravel master and my own project file.

But what i found the issue is: Is there a good way to find out the link between laravel/laravel and laravel/framework repo? Some times, laravel/laravel has not been updated, but if you check the laravel/framework repo has been pushed with some bugfixes. What currently do is to composer update every week. But it seems this is not a good solution.

Please or to participate in this conversation.