SmartyTerminal is a Laravel console/terminal, for the SmartyCMS content management system (CRUD) package.
Updated to work with Laravel 8 and PHP 8.0+
At this moment we support these commands:
- artisan - Artisan is the command line interface included with Laravel
- cleanup - Cleaning up the vendor folder
- clear - Clear screen in shell script
- completion - Dump the shell completion script
- composer - Run the Composer dependency manager
- find - Search for files in a directory hierarchy (!)
- help - Display help for a command
- list - List commands
- mysql - Run MySQL console
- tail - Run Tail command to get a real time log message
- tinker - Laravel Tinker is a powerful REPL for the Laravel framework
- vi - Run Vi editor
For usage documentation see Usage section bellow.
Supports: Laravel 6.0+, 7.0+, 8.0+ and PHP 7.2+, 8.0+
Important: Please, make sure you're at the latest version of Laravel 6, 7 or 8 to get PHP 8 support.
π‘ Install using composer:
$ composer require smartystudio/smartyterminal
π΅ Install using private package repository (BitBucket):
Add "smartystudio/smartyterminal": "dev-master"
to your composer.json
file.
Add the following to your composer.json
file after the scripts
section:
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:smartystudio/smartyterminal.git",
"options": {
"symlink": false
}
}
],
β NOTICE
If you want to develop the package locally, you need to add the following to your composer.json
file after the repositories
section:
"repositories": [
{
"type": "path",
"url": "packages/smartystudio/smartyterminal",
"options": {
"symlink": true
}
}
],
π‘ More info about Laravel package development, see here: Laravel Package Development
In Laravel 5.5+, with Package Auto Discovery it should all be set automatically.
For Laravel < 5.5, follow these instructions after composer finishes package installation:
Add the service provider to the providers array in config/app.php
for Laravel 5.4 and lower:
SmartyStudio\SmartyTerminal\TerminalServiceProvider::class,
npm install
$ cd src
$ npm install
bower install
$ cd src
$ bower install
build
$ cd src
$ npm run production
If npm trow an error, then do this:
npm cache clean --force
rm -rf node_modules
rm package-lock.json && rm yarn.lock
npm install
$ npm install cross-env
$ npm install
$ npm run dev
or $ npm run prod
('prod' is build for production environment).
Now, when your package's users execute the vendor:publish command, your assets will be copied to the specified publish location. Since you will typically need to overwrite the assets every time the package is updated, you may use the --force flag:
$ php artisan vendor:publish --tag=smartyterminal --force
https://yourwebiste.com/path/to/terminal
file: src/config/terminal.php
return [
/*
|--------------------------------------------------------------------------
| Package Enabled
|--------------------------------------------------------------------------
|
| This value determines whether the package is enabled. By default, it
| will be enabled if APP_DEBUG is true.
|
*/
'enabled' => env('APP_DEBUG'),
/*
|--------------------------------------------------------------------------
| Whitelisted IP Addresses
|--------------------------------------------------------------------------
|
| This value contains a list of IP addresses that are allowed to access
| the SmartyTerminal.
|
*/
'whitelists' => ['127.0.0.1'],
/*
|--------------------------------------------------------------------------
| Route Configuration
|--------------------------------------------------------------------------
|
| This value sets the route information such as the prefix and middleware.
|
*/
'route' => [
'prefix' => config('smartycms_config.route_prefix') . '/terminal',
'as' => 'terminal.',
// If you need auth, you need to use 'web' and specify an 'auth' middleware
'middleware' => [
'web',
SmartyStudio\SmartyCms\Http\Middleware\AuthenticateAdmin::class,
'role:superadministrator',
],
],
/*
|--------------------------------------------------------------------------
| Enabled Commands
|--------------------------------------------------------------------------
|
| This value contains a list of class names for the available commands
| for SmartyTerminal.
|
*/
'commands' => [
SmartyStudio\SmartyTerminal\Console\Commands\Artisan::class,
SmartyStudio\SmartyTerminal\Console\Commands\ArtisanTinker::class,
SmartyStudio\SmartyTerminal\Console\Commands\Cleanup::class,
SmartyStudio\SmartyTerminal\Console\Commands\Composer::class,
SmartyStudio\SmartyTerminal\Console\Commands\Find::class,
SmartyStudio\SmartyTerminal\Console\Commands\Mysql::class,
SmartyStudio\SmartyTerminal\Console\Commands\Tail::class,
SmartyStudio\SmartyTerminal\Console\Commands\Vi::class,
],
];
file: src/Console/Commands/MyNewCommandClass.php
namespace SmartyStudio\SmartyTerminal\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
use SmartyStudio\SmartyTerminal\Contracts\TerminalCommand;
class Inspire extends Command implements TerminalCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
$ artisan
# Running migrations and database seeds
$ artisan migrate --seed
$ cleanup
$ clear
$ completion
$ composer
$ find ./ -name * -maxdepth 1
# Not full support yet, but you can delete file using this command
# Don't forget to check file permissions
$ find ./vendor -name tests -type d -maxdepth 4 -delete
# Find and delete combination
$ find ./storage/logs -name * -maxdepth 1 -delete
$ help
$ list
$ mysql
mysql> select * from users;
# Change database connection
mysql> use sqlite;
mysql> select * from users;
$ tail
$ tail --line=1
$ tail server.php
$ tail server.php --line 5
$ artisan tinker
$ vi server.php
- [] Add tests
Visit our Documentation for detailed usage instructions.
Contributions to the SmartyCMS library are welcome. Please note the following guidelines before submitting your pull request.
- Follow PSR-4 coding standards.
- Write tests for new functions and added features
- use Laravel Mix for assets
This is licensed software. All copyrights are reserved by Smarty Studio MBN Ltd. In the event of improper use of the software or use without the permission of the author, all legal action will be taken.