This package will no longer be supported. You can find the current version here: https://github.com/skprods/advanced-laravel
composer require skprods/laravel-helpers ^2.0
After installation, connect the provider to your application.
In config/app.php
:
'providers' => [
...,
SKprods\LaravelHelpers\Providers\HelpersServiceProvider::class,
]
In bootstrap/app.php
:
$app->register(SKprods\LaravelHelpers\Providers\HelpersServiceProvider::class);
Console
is a facade for displaying information to the terminal.
It can be used to display the script execution process.
For example:
use SKprods\LaravelHelpers\Facades\Console;
Console::info('Hello from terminal!');
The output differs in color depending on the type.
Expanding interaction with the file system. You can use it to copy a file or directory to a new path.
use SKprods\LaravelHelpers\Filesystem;
$destinationPath = "/new/path/";
$sourceFile = "/path/to/file.jpg";
Filesystem::copyFile($sourceFile, $destinationPath);
// File will be accessible by the path /new/path/file.jpg
$sourceDir = "/path/to/dir";
Filesystem::copyDirectory($sourceDir, $destinationPath);
// All files of the original directory will be saved to
// the new directory. For example, /path/to/dir/file.jpg
// will be accessible by the path /new/path/file.jpg
Converter for path string. It converts the path according to certain rules:
- the path does not start with "/"
- the path to the directory ends with "/"
For example:
use SKprods\LaravelHelpers\Path;
$path = "/some/directory/and/some/file.jpg";
Path::prepareFile($path); // some/directory/and/some/file.jpg
$path = "/some/directory/path";
Path::prepareDirectory($path) // some/directory/path/