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

niran's avatar
Level 8

Careful, Laravel Commands are not careful

Be very careful with Laravel. Laravel does not check things before overwriting your existing files. I worked for 1 month on a project and just wanted to use users and registration. Laravel overwrote all my existing workflow without warning that there already exists files. Laravel, does not warn. They will overwrite all your important files if you run their commands.

Running:

php artisan breeze:install npm install && npm run dev

Will overwrite your routes/web.php file, without warning.

Guys, this is pretty shady. Laravel just because you are growing does not mean that you don't have the responsibility with your power to not inform users your dangerous installation steps that wipe out your existing installation data.

It really sucks that a Framework like Laravel would not care to do these small things to save huge headaches.

I know some of you would say that it is someone's fault for not backing up everything under the sun, but hey Laravel you cannot just assume that. You have to show some responsibility.

It really sucks that Laravel did not give me any pre-warning before destroying my entire build process and even overwriting crucial files!!!!!!!!!!!!!!!!!

0 likes
47 replies
thinkverse's avatar

Laravel Breeze and Jetstream are starter kits, they're meant to be installed when you start your project. As is says in the intro paragraph to starter kits.

"To give you a head start building your new Laravel application, we are happy to offer authentication and application starter kits. These kits automatically scaffold your application with the routes, controllers, and views you need to register and authenticate your application's users." - Starter Kits - Introduction

Pay attention to this line - "These kits automatically scaffold your application with the routes, controllers, and views", it gives you a clear indication that it will update your files with new ones.

This is also, IMHO a good example of why you should use a version control system, but that's just me.

Sorry you lost your progress though, that sucks.

4 likes
niran's avatar
Level 8

that is not a clear indication. It does not tell you how far the install will go. Does it say we will override your existing installation and any file or directory could be changed without warning? Scaffold does not mean that anything in your project can be overridden and you know that too. This install does more than it warns. That means something. @taylorotwell has overlooked how important it is to warn and how to say what exactly his install is going to do. If it is going to override not only 1 file but many files that change everything! This has been his practice these days, to not care and go ahead and do that! This is wrong! We are not installing another version of Laravel. Versioning tells you how serious an override is but installing a package does not tell you what that install is going to do. It is for that reason you must provide the appropriate warnings with the correct wording as well.

3 likes
sundern's avatar

@thinkverse GIT or Copy of the folder is a must at all times.. Basic knowledge not taken seriously. At the same time, a warning message is also very basic and it exists in all applications, I am not sure why laravel team didn't incorporate that..

thinkverse's avatar

@sundern it's not Laravel's job to make sure you use GIT or any other version control system. 🤔 Sure it's good to use and it's practically basic knowledge as you pointed out but it's not up to Laravel to enforce that IMO.

As for a warning message, as I wrote above, they do explain what the starter kits do. It's not Laravel's fault users don't read the documentation - which is also I might add - basic knowledge any developer should know. And as stated in the documentation.

These kits automatically scaffold your application with the routes, controllers, and views

And it's not Laravel's fault users use starter kits in already built applications, again - starter kits - notice the word starter, meaning something that is the beginning of a process, or for starters.

And scaffold, which in development terms is something to aid in project and or code generation. And that term is not Laravel specific, it's an industry-wide term.

The warning is all over the documentation for starter kits, just read the documentation and it tells you what it does. 🤷‍♂️

niran's avatar
Level 8

The more I look the more I see that Laravel overwrote more than just some files... they wrote over many files. This sucks. I can say for sure that Laravel, may create great CMS but they at the same time not responsible. They have destroyed all the work!!! Laravel you are really beginning to be an organization that we can trust less and less.... you don't even follow basic principle of courtesy!

trin's avatar

there used to be a saying: admins are divided into 2 categories. those who make backups and those who do not make backups yet. years of practice taught me to put even the simplest project into a git right away. and read documentation before install anything. look at it as an experience, use git, use ide with local history like phpstorm and don't blame the framework for your mistakes. if I wanted to develop on a framework with a bunch of foolproof protection, I would choose a graphics framework, my son has one. Well, throw a pull request into the breeze github, which warns during installation that your route/web.php is not empty. sure breeze suspects that it is being set into a new project.

lemmon's avatar

Don't be surprised if they add a warning for people new to laravel, sorry you lost your crucial files. The documentation does not indicate that it will wipe out files, but that is how it works. I did not realize that until I was watching a laravel tutorial How to Read Code: Season 2 and @jeffreyway said as much.

1 like
sundern's avatar

@lemmon If someone is following the tutorial and pay attention, then they are fine. Else, if you are not paying attention then that person will learn from the mistakes. I think learning the costly mistakes is the best way to learn for those less attentive players or doing things on our own.

niran's avatar
Level 8

So you are saying that Laravel, should. not warn you of overwritting many files and that it should not check, because big tech does not need to do things like this, they leave up to the programmer to trust or not to trust and up to the programmer to prevent him/herself from not getting screwed by the big tech who already knows that courtesy is a thing of the past and thus does not need to, nor should it warning of things that it will do on your servers/ computers?????! Like overwriting files without warning!

niran's avatar
Level 8

Scaffolding does not necessarily mean to overwrite files where and whenever it so desires. Scaffolding means that they will create something to make it easier on you, it does not to allow them to overwrite things that are already there, especially without warning!!!!!!!!! Many programs warn you! Many. Just Laravel, does not!!!!!

niran's avatar
Level 8

This install not only overwrites some files it changes even your complete configuration, 100%. It does not take in account anything! It overwrites everything!

niran's avatar
Level 8

No Framework, should have the right to override everything! Are you telling me that this guy @TaylorOtwell just needs to create new stuff, but not be expected to add an if condition in a script that allows the user a chance to choose if he wants to wipe out his/her existing settings, and files!? That install wipes out your app.js file your bootstrap.js your routes/web.php any files sitting inside the views/ folder that might have the same name as his stuff! This attitude that he does not need to think about courtesy during install is very wrong!

@TaylorOtwell, you need to be called out! You should not just override people's code and file structure to install your own! You need to always take in to account that not every person is going to understand the way you think! It is not even enough to say read the documentation, because there 1000's of tutorials and places to read on Laravel documentation that does not say in plain English: "By installing this, or by running this command, we will be overwriting so many files that you stuff will no longer work after we install X feature!!!!"

trin's avatar

I've been in your situation and I understand your pain) but you are wrong. Again, treat this as a new experience. well and a great way to refactor your code

niran's avatar
Level 8

How am I wrong? You should not just override people's code and file structure to install your own! You need to always take into account courtesy!!!!!!!!!

niran's avatar
Level 8

@trin, how about when you bring in your computer to get it repaired, because it has a os problem. So, to save time, because it is going to take a long time to fix it, I just format the drive and reinstall the OS so that when you pick it up that your computer is working again, even though all your data was wiped for convenience! Oh well, we did not tell you but your computer is working now! What would happen next? All trouble would ensue and would be responsible, because I wiped out your data and I did not specifically tell you and ask you if that was okay! In this way, it is quite similar situation. You might say, well this is application stuff... there is no time when it is okay to not warn the person of what is about to happen, unless you can prove that they fully understand that by doing so would make all things gone!

trin's avatar

you gave a great example. you come and ask to fix your computer, to which the guy says to you: “do you want a starterkit? we have an excellent one with authorization. " you answer "yes I want". you get a starterkit, boom

niran's avatar
Level 8

@trin, Your just jumping over the truth and trying to side swipe it! You are not facing the situation head on! And no, you cannot say that a starter kit is means to destroy all things in directories. That is not even what a starter kit is.

[https://dictionary.cambridge.org/dictionary/english/starter-kit]

The practice of courtesy or warning and giving clear warning is no longer important! It needs to be recovered back into the minds of people like @taylorotwell

trin's avatar

ok, you are right! make pull request to laravel/breeze! fix this bug, be a hero!

2 likes
warpig's avatar

All this time you could've done this:

  1. Restart your project
  2. Taking a break, time to clear your mind, telling yourself you should move on and learn from this mistake so it doesn't happen ever again.
  3. Admitting you could've been wrong? e.g. (and this is just speculation) maybe you didn't read the documentation? Ouch (yes im talking to you, ego)
  4. Analyzing, if, maybe, the context in which you understood the introduction to Breeze, was, perhpaps, (and im trying to be veeeeery careful), was, "somehow" gulp WRONG?
  5. Done something to relax you and come at it at another time.

But no. You chose to complain.

So this is yet another suggestion: you be careful. Complaining can do great damage to your brain. However I am truly sorry for your loss, @niran. https://www.entrepreneur.com/article/281734 go watch some funny dogs or cats videos or something!

4 likes
jlrdw's avatar

I know it's too late, but I always back up everything before I make any big changes.

2 likes
PatrickDaniel's avatar

While it would be tedious, a month of work is a lot so it might be worth trying to use CTRL+Z to undo the file changes. One way to narrow down which files were changed would be to install a new laravel project, and set up a first git commit. Then you could install breeze on your fresh project and see what files were changed from the initial commit, giving you a good starting point to undo changes in your project that got overwritten.

guybrush_threepwood's avatar

The year is 2021, how are you not using some type of Version Control System or at least making a daily ZIP backup of your project? (especially if you worked so hard on it and it was of great importance to you).

What would happen if you suffered from catastrophic disk failure? Would you complain to Western Digital?

What if your PC was hijacked by a virus or ransomware? Or if you just made a mistake doing a global search and replace?

3 likes
sr57's avatar

The year is a long time before 2021, how are a backup of your project, specially when your 'test' new command. It's rule number one for every IT works (not only for dev)

That's said, you are not (totally wrong), using starter kit on a not empty project could warn.

fylzero's avatar

@niran I submitted a PR to the Laravel documentation.

https://github.com/laravel/docs/pull/6834/commits/ac80d49c4384502948384334e9c5b7824da23748

This probably should be on there, that's fair to say...

With that said... not backing up your project or running a version control system, then installing any kind of package is just begging for a catastrophic problem. I would suggest you reflect on that and fix your process so that doesn't happen again.

I would also strongly urge you to be more respectful to people who are creating these tools that you benefit from. There are MANY pitfalls of programming that do not hold your hand or warn you. Pretty much every dev at some point has run a rm -rf or dropped tables they didn't mean to. You learn from it and you grow if you own the responsibility for it.

9 likes
kenprogrammer's avatar

Apologies, but you cannot refer to someone as "this guy" when they are spending their precious time to offer free stuff so that you can write better & secure software . Fabien Potencier(Creator of Symfony Framework) has said this before about open source: "The illusion of getting software for “free”: Open-Source contributors are the exploited slaves of the modern programming world."

https://twitter.com/fabpot/status/967337512535576576

2 likes
martinbean's avatar

@niran My biggest takeaway from your complaining was that you clearly weren’t using version control. If you were, then this would be a complete non-issue.

As previously mentioned, Breeze and Jetstream are starter kits; not libraries that should be installed part-way through a project. The docs even say as much:

Breeze provides a wonderful starting point for beginning a fresh Laravel application.

Note: a fresh Laravel application; not one you started a month ago. So if you’re going to go against how these packages are meant to be used, then expect side effects.

7 likes
fylzero's avatar

@martinbean Based on this comment and Dries comment on the PR, I actually closed it out.

The first step of installing Breeze is to create a new Laravel application.

This was simply a failure to follow instructions without a safety net.

4 likes
andrei9473's avatar

and also almost any new package wouldn't be an issue if you have tests

niran's avatar
Level 8

This is just like big tech., deciding the final outcome... I don't agree. You might be Level 50, but you guys should let people see this as it is important truth. The truth is that it is now up to the programmer / user of of Laravel to protect him/her of any issues, as Laravel commands will not do it (check for) you. You cannot just keep good PR for your website, you have to also keep information that states the truth, that many tools that are made available at the command line will mess up your stuff if you run them. This is not my only experience of this with the artisan command. The artisan command can be quite dangerous if you are not aware of what a command might do. Use Certain Artisan Commands "at your projects own Risk."

trin's avatar

in russia, we laugh at the rules like “don't put pets in the microwave”. we do not understand this. we don’t need to explain “don’t feed the bears, even if they smile at you”, this is understandable. if you want to turn an artisan into a microwave that says “don't put pets here”, you are unlikely to be supported by the professional community. no matter what level

3 likes
andrei9473's avatar

If you have tests for your application you can always reset it to your last commit if something went wrong. There's no issues at all

Snapey's avatar

the rm command can be quite dangerous if you don't bother to learn what it does.

Yet, it trusts me to know what I am doing

4 likes
jlrdw's avatar

Even back in my old dbase 3 days, we're talkin the late 1980s, when I had to use the big floppy disk, floppy's could fail, I made a backup of data just in case.

Now let's shoot to 2021, even a hard disk can fail, thus always backup your data on a regular basis.

I even have imaging software that backs up my whole Drive, and I do an incremental often when needed.

As a developer it's not just coding, it's other tasks involved also in protecting data, at one time a technical term for this is a database manager.

Edit: backing up to the same drive somewhere, should never considered being a backup.

Get yourself at least a 2 terabyte Seagate or Western Digital external drive back up to it often, and somewhere else, I use Google Drive.

Always backup important and critical data to at least two places separate from one another.

Of course these are just suggestions.

3 likes
trin's avatar

wow, alive man, who remembers dbase III

Snapey's avatar

I do, but I refrain from referring to it as its not relevant to any current problems.

OP just needs to learn to use a version control system, and use a cloud based git repository = no backup issues.

1 like
piljac1's avatar

I really like to help people here and I'm always patient and try to politely explain the issue with someone's code or thought process, but politeness and respect goes both ways, so sorry in advance if I seem a bit crude.

You keep bashing Taylor like he represents the only source of responsibility in the unfortunate event you encountered, but in reality, you're the only master of your craft. Are you basically telling us that if you burn your steak, you're not the one responsible, but the butcher is for not telling you how to cook it properly?

You should grow from your mistake(s) instead of pointing fingers. For example, today one of our interns ended up with an unintended Git stash/pop related error. Did he blame Git for not telling him that it could create a merge conflict? No. He tried to understand why it happened. This is the type of attitude you should thrive for. Learn why something happened instead of blaming anyone but you.

So even though countless of people on this thread mentioned it already, here are two steps you can take to make sure you never encounter this type of problem in the future:

  1. Use a version control software, such as Git, so you can keep track of your project's evolution, and revert back to the latest stable increment if something happens.
  2. Keep backups of your folders/files.

Sorry but, this is how I picture you right now.

Big Tech Bike Fail Meme

12 likes
trin's avatar

four days, my popcorn is already cold

2 likes
devingray_'s avatar

Lol, I also had a look at past questions and thread replies from the OP and they all seem to be very passive aggressive. Yikes. Pop Corn on me for the next one

ravenshill's avatar

What he said.

Use a version control software, such as Git, so you can keep track of your project's evolution, and revert back to the latest stable increment if something happens.

Keep backups of your folders/files.

------Sorry but duh..

Don't blame TO for a rookie mistake on your part. I use git discover exactly what artisan commands do. Check your project in, run the command do a git status.

1 like
niran's avatar
Level 8

Wow! Thanks for all your input/energy on this post!

Lol, you guys are all correct :), I do think that frameworks should be more backwards compatible. It is true that I should use git and believe me "I do," but for a project I was working on, this one... I did not push it yet, that was my bad! None-the-less, it is quite important to be backwards compatible. Sorry @taylorotwell, it is not your fault, we have all been contributing to the big mess of backwards compatibility :(.

See this Wikipedia article: https://en.wikipedia.org/wiki/Backward_compatibility#:~:text=Backward%20compatibility%20can%20be%20used,value%20of%20supporting%20older%20software.

Although functionality (INTERNALLY) might change, we should do more to keep things working even when the way things work inside change. Also, it might be a SMART idea to include a feature to add a change and then add a switch that can turn on/off a new package that was introduced.

Similar to a version control system, their could co exist a version control like library that could allow versioning of builds on a development level, not a GIT level, but similar, maybe even use git to do this for us in the background on another specified path to backup all things before running a package install, either through composer or artisan commands.

Guys/Gals, what I see in the big picture is that when working on LARGE projects, whatever you interpret as LARGE, being able to easily upgrade to the latest releases (versions) should be able to do so without having to refactor(re-code) your projects. The TRUTH is that when a feature that was popular is just removed or is changed (DRASTICALLY) then you are faced with a decision to DROP the current framework, or write/hack your own version to work with your existing system (usually a project that grows becomes more of a system than just a project). We/Company's/Bosses' all want to be able to use that latest feature, but when faced with constant upgrades and issues with backwards compatibilities it is so hard to do so. Should it be this way? Taking a look at this article https://medium.com/ironkeel/breaking-backwards-compatibility-81c7986f234b we/you/me find it a problem to have to always be chasing the updates and keeping our System relevant with today's standards and technologies.

I, for one, think that being relevant without having to rewrite layers(changing code everywhere) of code, but having procedures/rules in place that would allow even older code to conform to new changes, via interfaces, is not only ideal but a necessary evil (must be implemented to save the hell that follows with upgrades/updates) and possibly even be the right thing to do (the way to go) moving forward.

Of course, I am only one person, but I think that many of you share some of the same sentiment mentioned above.

What are your guys/gals thoughts? @jeffreyway, @taylorotwell, @everyone!?

jlrdw's avatar

@niran my thought is I don't see big drastic changes between version 6 of laravel version 8.

Yes of course there are changes if you use the very latest Stacks offered. But I use fetch Js and regular JavaScript and bootstrap and custom CSS, and that's it.

So I currently have a version 8 and of course there were a few changes because of PHP 8 but that had nothing to do with laravel. Like the order of parameters.

And git Version Control that is in development, you push to a staging.

The trick is if you are going to use something new that's not in your current version don't try to do it overnight take time and migrate over keeping your current application backed up.

An example I went from some Jquery stuff to fetch Js, but believe me I had everything backed up as a just in case.

But this post will help others as well, it will remind people to definitely backup data before any changes, and don't feel alone we have all done something similar in the past that's how we learn.

niran's avatar
Level 8

@jlrdw let's get beyond the git and backup stuff, as this is clear that we ALL must do this. The point now, is to read my last post and to reflect on that. There are drastic changes to the UI, by the way. That is what happened when I used the artisan command to install a newer scaffolding that will break, for one because it overwrites files all over the place... but what I am referring to, at this point, is to building into the either/both the practices to create more interfaced libraries that don't just make it or break-it code that already exists = ). Well... please just read my previous post = )

Cheers mate!

jlrdw's avatar

@niran the UI is the same, there is a big difference between Breeze and the UI.

In other words an upgrade from version 6 to 7 then 7 to 8 would not have broke things.

Laravel has not changed that much in quite some time. What has changed is the extras you can use and the different scaffolding it has now but remember all that is optional.

Now me I did set up one of each just to play with them and learn them some. If I had to pick one of the new ones I would go with Breeze, just my preference.

But don't forget the Authentication chapter he also covers how to do the manual Authentication.

But bottom line don't compare laravel to all the add-ons and libraries and vue, interia, jetstream, all that stuff, the basic laravel is the same.

Next

Please or to participate in this conversation.