Skip to content

Commit 23cf121

Browse files
committed
feat: init laravel zero
0 parents  commit 23cf121

19 files changed

+6497
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
/.idea
3+
/.vscode
4+
/.vagrant
5+
.phpunit.result.cache

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 CODING Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CODING cli
2+
3+
CODING cli 基于 [Laravel Zero](https://laravel-zero.com/)

app/Commands/.gitkeep

Whitespace-only changes.

app/Commands/InspiringCommand.php

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Commands;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use LaravelZero\Framework\Commands\Command;
7+
8+
class InspiringCommand extends Command
9+
{
10+
/**
11+
* The signature of the command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'inspiring {name=Artisan}';
16+
17+
/**
18+
* The description of the command.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Display an inspiring quote';
23+
24+
/**
25+
* Execute the console command.
26+
*
27+
* @return mixed
28+
*/
29+
public function handle()
30+
{
31+
$this->info('Simplicity is the ultimate sophistication.');
32+
}
33+
34+
/**
35+
* Define the command's schedule.
36+
*
37+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
38+
* @return void
39+
*/
40+
public function schedule(Schedule $schedule)
41+
{
42+
// $schedule->command(static::class)->everyMinute();
43+
}
44+
}

app/Providers/AppServiceProvider.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class AppServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Bootstrap any application services.
11+
*
12+
* @return void
13+
*/
14+
public function boot()
15+
{
16+
//
17+
}
18+
19+
/**
20+
* Register any application services.
21+
*
22+
* @return void
23+
*/
24+
public function register()
25+
{
26+
//
27+
}
28+
}

bootstrap/app.php

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Create The Application
6+
|--------------------------------------------------------------------------
7+
|
8+
| The first thing we will do is create a new Laravel application instance
9+
| which serves as the "glue" for all the components of Laravel, and is
10+
| the IoC container for the system binding all of the various parts.
11+
|
12+
*/
13+
14+
$app = new LaravelZero\Framework\Application(
15+
dirname(__DIR__)
16+
);
17+
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Bind Important Interfaces
21+
|--------------------------------------------------------------------------
22+
|
23+
| Next, we need to bind some important interfaces into the container so
24+
| we will be able to resolve them when needed. The kernels serve the
25+
| incoming requests to this application from both the web and CLI.
26+
|
27+
*/
28+
29+
$app->singleton(
30+
Illuminate\Contracts\Console\Kernel::class,
31+
LaravelZero\Framework\Kernel::class
32+
);
33+
34+
$app->singleton(
35+
Illuminate\Contracts\Debug\ExceptionHandler::class,
36+
Illuminate\Foundation\Exceptions\Handler::class
37+
);
38+
39+
/*
40+
|--------------------------------------------------------------------------
41+
| Return The Application
42+
|--------------------------------------------------------------------------
43+
|
44+
| This script returns the application instance. The instance is given to
45+
| the calling script so we can separate the building of the instances
46+
| from the actual running of the application and sending responses.
47+
|
48+
*/
49+
50+
return $app;

box.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"chmod": "0755",
3+
"directories": [
4+
"app",
5+
"bootstrap",
6+
"config",
7+
"vendor"
8+
],
9+
"files": [
10+
"composer.json"
11+
],
12+
"exclude-composer-files": false,
13+
"compression": "GZ",
14+
"compactors": [
15+
"KevinGH\\Box\\Compactor\\Php",
16+
"KevinGH\\Box\\Compactor\\Json"
17+
]
18+
}

coding

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
define('LARAVEL_START', microtime(true));
5+
6+
/*
7+
|--------------------------------------------------------------------------
8+
| Register The Auto Loader
9+
|--------------------------------------------------------------------------
10+
|
11+
| Composer provides a convenient, automatically generated class loader
12+
| for our application. We just need to utilize it! We'll require it
13+
| into the script here so that we do not have to worry about the
14+
| loading of any our classes "manually". Feels great to relax.
15+
|
16+
*/
17+
18+
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
19+
20+
$app = require_once __DIR__.'/bootstrap/app.php';
21+
22+
/*
23+
|--------------------------------------------------------------------------
24+
| Run The Artisan Application
25+
|--------------------------------------------------------------------------
26+
|
27+
| When we run the console application, the current CLI command will be
28+
| executed in this console and the response sent back to a terminal
29+
| or another output device for the developers. Here goes nothing!
30+
|
31+
*/
32+
33+
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
34+
35+
$status = $kernel->handle(
36+
$input = new Symfony\Component\Console\Input\ArgvInput,
37+
new Symfony\Component\Console\Output\ConsoleOutput
38+
);
39+
40+
/*
41+
|--------------------------------------------------------------------------
42+
| Shutdown The Application
43+
|--------------------------------------------------------------------------
44+
|
45+
| Once Artisan has finished running, we will fire off the shutdown events
46+
| so that any final work may be done by the application before we shut
47+
| down the process. This is the last thing to happen to the request.
48+
|
49+
*/
50+
51+
$kernel->terminate($input, $status);
52+
53+
exit($status);

composer.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "laravel-zero/laravel-zero",
3+
"description": "The Laravel Zero Framework.",
4+
"keywords": ["framework", "laravel", "laravel zero", "console", "cli"],
5+
"homepage": "https://laravel-zero.com",
6+
"type": "project",
7+
"license": "MIT",
8+
"support": {
9+
"issues": "https://github.com/laravel-zero/laravel-zero/issues",
10+
"source": "https://github.com/laravel-zero/laravel-zero"
11+
},
12+
"authors": [
13+
{
14+
"name": "Nuno Maduro",
15+
"email": "[email protected]"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.3|^8.0",
20+
"laravel-zero/framework": "^8.8"
21+
},
22+
"require-dev": {
23+
"mockery/mockery": "^1.4.3",
24+
"pestphp/pest": "^1.3"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"App\\": "app/"
29+
}
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"Tests\\": "tests/"
34+
}
35+
},
36+
"config": {
37+
"preferred-install": "dist",
38+
"sort-packages": true,
39+
"optimize-autoloader": true
40+
},
41+
"minimum-stability": "dev",
42+
"prefer-stable": true,
43+
"bin": ["coding"]
44+
}

0 commit comments

Comments
 (0)