Do you know about Laravel vendor publish?

Patrick Wan
2 min readOct 9, 2023

Laravel vendor publish allow you to select which vendor config, public assets or resources file to publish


The vendor:publish command in Laravel did not have a built-in search functionality on the prompt. This means that when you run php artisan vendor:publish, it lists all available package providers, and you need to select the provider you want to publish files for manually by typing its number.

However, you can implement a custom solution to add search functionality to the vendor:publish prompt by extending the VendorPublishCommand class provided by Laravel. Here's a high-level overview of how you can do it:

  1. Create a new command class that extends the VendorPublishCommand class:
php artisan make:command CustomVendorPublish

2. In your CustomVendorPublish command class, override the getAvailableProviders method to filter the available providers based on the user's search input:

protected function getAvailableProviders()
$providers = parent::getAvailableProviders();

$searchTerm = $this->ask('Enter a search term to filter providers:');

if (!empty($searchTerm)) {
$providers = array_filter($providers, function ($provider) use ($searchTerm) {
return str_contains($provider, $searchTerm);



Patrick Wan

My name’s Patrick. I’m a Software Developer, experience in Laravel, Vue Js, React Js, Livewire, Jquery, Codegniter, NPM, GIT. I have 5 years plus experience.