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

PeterPan's avatar

Why do we do a php artisan vendor:publish

I am starting to use MaatWebsite/excel. One of the step is to do a php artisan vendor:publish.

However, being new to laravel and looking thru the documentation, and also getting the excel to work in my application, i dont really get it why we will need to do this step? And I do see some packages need to do this also.

Is it so that a copy of the excel.php is simply copied to some public folder?

To publish the config settings in Laravel 5 use:

php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
This will add an excel.php config file to your config folder.
0 likes
3 replies
primordial's avatar

@PeterPan The vendor folder should not be under revision control as such, it will be overwritten every time you deploy your solution. You use vendor:publish to copy configurable items to your application code base such that any changes you make will not keep being lost.

Make sense?

8 likes
kingpabel's avatar
Level 5

vendor:publish command used to copy few configuration file in your application from vendor package file.Like you are using a package where need to create a table on database and need to store few demo data.That time your packages will keep database schema and seeding and when you run vendor:publish those schema and seeding file will copy in your application.After that you just run php artisan migrate and php artisan db:seed

6 likes
PeterPan's avatar

@primordial . Good to know.

I was looking also googling around to find on who to upload my application (i am almost done) to the server, which hosting to use (VPS, shared hosting) etc for laravel. I never hosted a site before :(

Initially, I just thought of just copy EXACTLY the entire laravel folder on my laptop the server including the vendor files. So this might be a not be an issue as the vendor files will not be overwritten?

@kingpabel good scenario. Will be useful next time when i need the vendor package to setup a schema for my app. So far, I am not using any schema from the vendor yet.. :P

Please or to participate in this conversation.