PHP code example of goszowski / stub

1. Go to this page and download the library: Download goszowski/stub 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/ */

    

goszowski / stub example snippets


 

use Goszowski\Stub\Stub;

$stub = new Stub;
$stub->load('/path/to/stub/file');

$stub->replace('some_1', 'other_1');
$stub->replace('some_2', 'other_2');

// OR WITH ARRAY

$stub->replace([
  'some_1' => 'other_1',
  'some_2' => 'other_2',
]);

$stub->store('/path/to/save/file', 'filename');

 
namsepace App\YourNamespace;

use Facades\ {
  Goszowski\Stub\Stub
};

$stub = Stub::load('/path/to/stub/file');

$stub->replace('some_1', 'other_1');
$stub->replace('some_2', 'other_2');

// OR WITH ARRAY

$stub->replace([
  'some_1' => 'other_1',
  'some_2' => 'other_2',
]);

$stub->store('/path/to/save/file', 'filename');