Skip to content

Instantly share code, notes, and snippets.

@digitalkreativ
Created August 25, 2018 14:00
Show Gist options
  • Save digitalkreativ/1220ede8bc14cc40a2af071fd532dad0 to your computer and use it in GitHub Desktop.
Save digitalkreativ/1220ede8bc14cc40a2af071fd532dad0 to your computer and use it in GitHub Desktop.
Laravel Zero adding extra files to the phar build
<?php
// Put this file in config directory
return [
/*
|---------------------------------
| STRUCTURE
|---------------------------------
|
| Adds extra folders or files to the phar file when running app:build-custom
|
*/
'structure' => [
'resources/',
]
];
<?php
// Put this file in app/Commands directory
namespace App\Commands;
use LaravelZero\Framework\Commands\App\Builder;
class CustomBuilder extends Builder
{
/**
* The signature of the command.
*
* @var string
*/
protected $signature = 'app:build-custom {name=application : The build name} {--with-dev : Whether the dev dependencies should be included}';
/**
* The description of the command.
*
* @var string
*/
protected $description = 'Create the necessary docker setup files in _docker folder';
public function handle(): void
{
$customStructure = config('build-custom.structure') ?? [];
if( is_array( $customStructure ) && !empty( $customStructure ) ){
$this->task('Add extra structure', function() use ($customStructure ){
$this->structure = array_merge( $customStructure, $this->structure );
return true;
});
}
parent::handle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment