generated from Lemon-Framework/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.php
29 lines (24 loc) · 877 Bytes
/
commands.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
declare(strict_types=1);
use App\ArrayExporter;
use Lemon\Contracts\Config\Config;
use Lemon\Terminal;
Terminal::command('services:build', function (Config $config) {
$file = $config->file('services.file', 'php');
file_put_contents($file, ArrayExporter::export([]));
}, 'builds services file');
Terminal::command('repl', function () {
Terminal::out('<div class="text-yellow">Repl started</div>');
system('psysh init.php > `tty`');
}, 'starts repl (requires psysh on your machine)');
Terminal::command('token:generate', function () {
$token = sha1(
str_shuffle(
'traktor'
.(string) time()
.'Rain on Your Parade'
)
);
Terminal::out('<div class="text-yellow">Your token is: '.$token.'</div>');
file_put_contents(__DIR__.'/tokens', $token."\n", FILE_APPEND);
}, 'generates api token');