1. Go to this page and download the library: Download lukeraymonddowning/stubble library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lukeraymonddowning / stubble example snippets
// class.php.stub
class {{ class }} extends Component {
public function render() {
return view('{{ view }}');
}
}
// class.php.stub
class {{ class | pascal }} extends Component {
public function render() {
return view('{{ class | kebab }}');
}
}
public function handle() {
Stubble::publish('path/to/your/stub.php', app_path('Some/Directory/File.php'), ['class' => $this->argument('name')]);
}
// class: Some\Deeply\Nested\Thing
class {{ class | basename }} {} // class Thing {}
// class: Some/Class/With/Forward/Slashes
use {{ class | classname }} // Some\Class\With\Forward\Slashes
// view: some-nested.view
use {{ view | classname }} // SomeNested\View
// .stub
Welcome to the {{ jungle | upper | plural }}! // Welcome to the JUNGLES!
// ServiceProvider
Modifier::macro('vowelless', function ($content) {
return Str::of($content)->remove(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'])->__toString();
});
// .stub
Hello {{ example | vowelless }} // All vowels will be removed from the value of 'example'
Stubble::defineTags('--', '--'); // Use -- as the tag locators
Stubble::defineTags('{{', '--'); // Use {{ as the starting locator and -- as the ending locator
bash
php artisan make:magic MyDesiredClassName
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.