Skip to content
This repository was archived by the owner on Jul 4, 2018. It is now read-only.

Commit ae5bead

Browse files
committed
Initial commit
0 parents  commit ae5bead

37 files changed

+4395
-0
lines changed

.env.example

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
APP_KEY=
4+
APP_TIMEZONE=UTC
5+
6+
DB_CONNECTION=mysql
7+
DB_HOST=127.0.0.1
8+
DB_PORT=3306
9+
DB_DATABASE=homestead
10+
DB_USERNAME=homestead
11+
DB_PASSWORD=secret
12+
13+
CACHE_DRIVER=file
14+
QUEUE_DRIVER=sync

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# phpstorm files
2+
/.idea
3+
4+
# composer vendor dir
5+
/vendor
6+
7+
# project config file
8+
.env

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Lumen micro-framework lessons
2+
=============================
3+
4+
This is test project for learning of Lumen micro-framework.
5+
6+
Create lumen project
7+
--------------------
8+
Create project via lumen installer:
9+
10+
install lumen installer
11+
```
12+
composer global require "laravel/lumen-installer"
13+
```
14+
15+
create project
16+
```
17+
~/.composer/vendor/bin lumen new project-name
18+
```
19+
20+
Or create project via composer:
21+
```
22+
composer create-project --prefer-dist laravel/lumen project-name
23+
```
24+
25+
Next step you should to install composer packages
26+
```
27+
cd project-name && composer install
28+
```

app/Console/Commands/.gitkeep

Whitespace-only changes.

app/Console/Kernel.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
//
28+
}
29+
}

app/Events/Event.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use Illuminate\Queue\SerializesModels;
6+
7+
abstract class Event
8+
{
9+
use SerializesModels;
10+
}

app/Events/ExampleEvent.php

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
class ExampleEvent extends Event
6+
{
7+
/**
8+
* Create a new event instance.
9+
*
10+
* @return void
11+
*/
12+
public function __construct()
13+
{
14+
//
15+
}
16+
}

app/Exceptions/Handler.php

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Validation\ValidationException;
7+
use Illuminate\Auth\Access\AuthorizationException;
8+
use Illuminate\Database\Eloquent\ModelNotFoundException;
9+
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
10+
use Symfony\Component\HttpKernel\Exception\HttpException;
11+
12+
class Handler extends ExceptionHandler
13+
{
14+
/**
15+
* A list of the exception types that should not be reported.
16+
*
17+
* @var array
18+
*/
19+
protected $dontReport = [
20+
AuthorizationException::class,
21+
HttpException::class,
22+
ModelNotFoundException::class,
23+
ValidationException::class,
24+
];
25+
26+
/**
27+
* Report or log an exception.
28+
*
29+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
30+
*
31+
* @param \Exception $e
32+
* @return void
33+
*/
34+
public function report(Exception $e)
35+
{
36+
parent::report($e);
37+
}
38+
39+
/**
40+
* Render an exception into an HTTP response.
41+
*
42+
* @param \Illuminate\Http\Request $request
43+
* @param \Exception $e
44+
* @return \Illuminate\Http\Response
45+
*/
46+
public function render($request, Exception $e)
47+
{
48+
return parent::render($request, $e);
49+
}
50+
}

app/Http/Controllers/Controller.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Laravel\Lumen\Routing\Controller as BaseController;
6+
7+
class Controller extends BaseController
8+
{
9+
//
10+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
class ExampleController extends Controller
6+
{
7+
/**
8+
* Create a new controller instance.
9+
*
10+
* @return void
11+
*/
12+
public function __construct()
13+
{
14+
//
15+
}
16+
17+
//
18+
}

app/Http/Middleware/Authenticate.php

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Closure;
6+
use Illuminate\Contracts\Auth\Factory as Auth;
7+
8+
class Authenticate
9+
{
10+
/**
11+
* The authentication guard factory instance.
12+
*
13+
* @var \Illuminate\Contracts\Auth\Factory
14+
*/
15+
protected $auth;
16+
17+
/**
18+
* Create a new middleware instance.
19+
*
20+
* @param \Illuminate\Contracts\Auth\Factory $auth
21+
* @return void
22+
*/
23+
public function __construct(Auth $auth)
24+
{
25+
$this->auth = $auth;
26+
}
27+
28+
/**
29+
* Handle an incoming request.
30+
*
31+
* @param \Illuminate\Http\Request $request
32+
* @param \Closure $next
33+
* @param string|null $guard
34+
* @return mixed
35+
*/
36+
public function handle($request, Closure $next, $guard = null)
37+
{
38+
if ($this->auth->guard($guard)->guest()) {
39+
return response('Unauthorized.', 401);
40+
}
41+
42+
return $next($request);
43+
}
44+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Closure;
6+
7+
class ExampleMiddleware
8+
{
9+
/**
10+
* Handle an incoming request.
11+
*
12+
* @param \Illuminate\Http\Request $request
13+
* @param \Closure $next
14+
* @return mixed
15+
*/
16+
public function handle($request, Closure $next)
17+
{
18+
return $next($request);
19+
}
20+
}

app/Jobs/ExampleJob.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Jobs;
4+
5+
class ExampleJob extends Job
6+
{
7+
/**
8+
* Create a new job instance.
9+
*
10+
* @return void
11+
*/
12+
public function __construct()
13+
{
14+
//
15+
}
16+
17+
/**
18+
* Execute the job.
19+
*
20+
* @return void
21+
*/
22+
public function handle()
23+
{
24+
//
25+
}
26+
}

app/Jobs/Job.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App\Jobs;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Queue\SerializesModels;
7+
use Illuminate\Queue\InteractsWithQueue;
8+
use Illuminate\Contracts\Queue\ShouldQueue;
9+
10+
abstract class Job implements ShouldQueue
11+
{
12+
/*
13+
|--------------------------------------------------------------------------
14+
| Queueable Jobs
15+
|--------------------------------------------------------------------------
16+
|
17+
| This job base class provides a central location to place any logic that
18+
| is shared across all of your jobs. The trait included with the class
19+
| provides access to the "queueOn" and "delay" queue helper methods.
20+
|
21+
*/
22+
23+
use InteractsWithQueue, Queueable, SerializesModels;
24+
}

app/Listeners/ExampleListener.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace App\Listeners;
4+
5+
use App\Events\ExampleEvent;
6+
use Illuminate\Queue\InteractsWithQueue;
7+
use Illuminate\Contracts\Queue\ShouldQueue;
8+
9+
class ExampleListener
10+
{
11+
/**
12+
* Create the event listener.
13+
*
14+
* @return void
15+
*/
16+
public function __construct()
17+
{
18+
//
19+
}
20+
21+
/**
22+
* Handle the event.
23+
*
24+
* @param ExampleEvent $event
25+
* @return void
26+
*/
27+
public function handle(ExampleEvent $event)
28+
{
29+
//
30+
}
31+
}

app/Providers/AppServiceProvider.php

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

0 commit comments

Comments
 (0)