From 3a74377e861c1a401f1dffbd595f547e04eb72c8 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Fri, 22 Jan 2016 12:01:33 +0100
Subject: Initial commit
---
.env.example | 13 ++++
.gitignore | 4 ++
app/Console/Commands/.gitkeep | 0
app/Console/Kernel.php | 29 +++++++++
app/Events/Event.php | 10 +++
app/Events/ExampleEvent.php | 16 +++++
app/Exceptions/Handler.php | 50 +++++++++++++++
app/Http/Controllers/Controller.php | 10 +++
app/Http/Controllers/ExampleController.php | 18 ++++++
app/Http/Middleware/Authenticate.php | 44 +++++++++++++
app/Http/Middleware/ExampleMiddleware.php | 20 ++++++
app/Http/routes.php | 16 +++++
app/Jobs/ExampleJob.php | 26 ++++++++
app/Jobs/Job.php | 24 +++++++
app/Listeners/ExampleListener.php | 31 +++++++++
app/Providers/AppServiceProvider.php | 18 ++++++
app/Providers/AuthServiceProvider.php | 40 ++++++++++++
app/Providers/EventServiceProvider.php | 19 ++++++
app/User.php | 34 ++++++++++
artisan | 35 ++++++++++
bootstrap/app.php | 100 +++++++++++++++++++++++++++++
composer.json | 27 ++++++++
database/factories/ModelFactory.php | 19 ++++++
database/migrations/.gitkeep | 0
database/seeds/DatabaseSeeder.php | 16 +++++
phpunit.xml | 26 ++++++++
public/.htaccess | 16 +++++
public/index.php | 28 ++++++++
readme.md | 21 ++++++
resources/views/.gitkeep | 0
storage/app/.gitignore | 2 +
storage/framework/views/.gitignore | 2 +
storage/logs/.gitignore | 2 +
tests/ExampleTest.php | 20 ++++++
tests/TestCase.php | 14 ++++
35 files changed, 750 insertions(+)
create mode 100644 .env.example
create mode 100644 .gitignore
create mode 100644 app/Console/Commands/.gitkeep
create mode 100644 app/Console/Kernel.php
create mode 100644 app/Events/Event.php
create mode 100644 app/Events/ExampleEvent.php
create mode 100644 app/Exceptions/Handler.php
create mode 100644 app/Http/Controllers/Controller.php
create mode 100644 app/Http/Controllers/ExampleController.php
create mode 100644 app/Http/Middleware/Authenticate.php
create mode 100644 app/Http/Middleware/ExampleMiddleware.php
create mode 100644 app/Http/routes.php
create mode 100644 app/Jobs/ExampleJob.php
create mode 100644 app/Jobs/Job.php
create mode 100644 app/Listeners/ExampleListener.php
create mode 100644 app/Providers/AppServiceProvider.php
create mode 100644 app/Providers/AuthServiceProvider.php
create mode 100644 app/Providers/EventServiceProvider.php
create mode 100644 app/User.php
create mode 100644 artisan
create mode 100644 bootstrap/app.php
create mode 100644 composer.json
create mode 100644 database/factories/ModelFactory.php
create mode 100644 database/migrations/.gitkeep
create mode 100644 database/seeds/DatabaseSeeder.php
create mode 100644 phpunit.xml
create mode 100644 public/.htaccess
create mode 100644 public/index.php
create mode 100644 readme.md
create mode 100644 resources/views/.gitkeep
create mode 100644 storage/app/.gitignore
create mode 100644 storage/framework/views/.gitignore
create mode 100644 storage/logs/.gitignore
create mode 100644 tests/ExampleTest.php
create mode 100644 tests/TestCase.php
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..f341890
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,13 @@
+APP_ENV=local
+APP_DEBUG=true
+APP_KEY=SomeRandomKey!!!
+
+DB_CONNECTION=mysql
+DB_HOST=localhost
+DB_PORT=3306
+DB_DATABASE=homestead
+DB_USERNAME=homestead
+DB_PASSWORD=secret
+
+CACHE_DRIVER=memcached
+QUEUE_DRIVER=sync
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..18a13a3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/vendor
+.env
+composer.lock
+
diff --git a/app/Console/Commands/.gitkeep b/app/Console/Commands/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
new file mode 100644
index 0000000..ad6e311
--- /dev/null
+++ b/app/Console/Kernel.php
@@ -0,0 +1,29 @@
+auth = $auth;
+ }
+
+ /**
+ * Handle an incoming request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @param string|null $guard
+ * @return mixed
+ */
+ public function handle($request, Closure $next, $guard = null)
+ {
+ if ($this->auth->guard($guard)->guest()) {
+ return response('Unauthorized.', 401);
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/ExampleMiddleware.php b/app/Http/Middleware/ExampleMiddleware.php
new file mode 100644
index 0000000..166581c
--- /dev/null
+++ b/app/Http/Middleware/ExampleMiddleware.php
@@ -0,0 +1,20 @@
+get('/', function () use ($app) {
+ return $app->version();
+});
diff --git a/app/Jobs/ExampleJob.php b/app/Jobs/ExampleJob.php
new file mode 100644
index 0000000..7b65bb4
--- /dev/null
+++ b/app/Jobs/ExampleJob.php
@@ -0,0 +1,26 @@
+input('api_token')) {
+ return User::where('api_token', $request->input('api_token'))->first();
+ }
+ });
+ }
+}
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
new file mode 100644
index 0000000..0b8f393
--- /dev/null
+++ b/app/Providers/EventServiceProvider.php
@@ -0,0 +1,19 @@
+ [
+ 'App\Listeners\EventListener',
+ ],
+ ];
+}
diff --git a/app/User.php b/app/User.php
new file mode 100644
index 0000000..fd4de31
--- /dev/null
+++ b/app/User.php
@@ -0,0 +1,34 @@
+make(
+ 'Illuminate\Contracts\Console\Kernel'
+);
+
+exit($kernel->handle(new ArgvInput, new ConsoleOutput));
diff --git a/bootstrap/app.php b/bootstrap/app.php
new file mode 100644
index 0000000..5487cb5
--- /dev/null
+++ b/bootstrap/app.php
@@ -0,0 +1,100 @@
+load();
+} catch (Dotenv\Exception\InvalidPathException $e) {
+ //
+}
+
+/*
+|--------------------------------------------------------------------------
+| Create The Application
+|--------------------------------------------------------------------------
+|
+| Here we will load the environment and create the application instance
+| that serves as the central piece of this framework. We'll use this
+| application as an "IoC" container and router for this framework.
+|
+*/
+
+$app = new Laravel\Lumen\Application(
+ realpath(__DIR__.'/../')
+);
+
+// $app->withFacades();
+
+// $app->withEloquent();
+
+/*
+|--------------------------------------------------------------------------
+| Register Container Bindings
+|--------------------------------------------------------------------------
+|
+| Now we will register a few bindings in the service container. We will
+| register the exception handler and the console kernel. You may add
+| your own bindings here if you like or you can make another file.
+|
+*/
+
+$app->singleton(
+ Illuminate\Contracts\Debug\ExceptionHandler::class,
+ App\Exceptions\Handler::class
+);
+
+$app->singleton(
+ Illuminate\Contracts\Console\Kernel::class,
+ App\Console\Kernel::class
+);
+
+/*
+|--------------------------------------------------------------------------
+| Register Middleware
+|--------------------------------------------------------------------------
+|
+| Next, we will register the middleware with the application. These can
+| be global middleware that run before and after each request into a
+| route or middleware that'll be assigned to some specific routes.
+|
+*/
+
+// $app->middleware([
+// App\Http\Middleware\ExampleMiddleware::class
+// ]);
+
+// $app->routeMiddleware([
+// 'auth' => App\Http\Middleware\Authenticate::class,
+// ]);
+
+/*
+|--------------------------------------------------------------------------
+| Register Service Providers
+|--------------------------------------------------------------------------
+|
+| Here we will register all of the application's service providers which
+| are used to bind services into the container. Service providers are
+| totally optional, so you are not required to uncomment this line.
+|
+*/
+
+// $app->register(App\Providers\AppServiceProvider::class);
+// $app->register(App\Providers\AuthServiceProvider::class);
+// $app->register(App\Providers\EventServiceProvider::class);
+
+/*
+|--------------------------------------------------------------------------
+| Load The Application Routes
+|--------------------------------------------------------------------------
+|
+| Next we will include the routes file so that they can all be added to
+| the application. This will provide all of the URLs the application
+| can respond to, as well as the controllers that may handle them.
+|
+*/
+
+$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
+ require __DIR__.'/../app/Http/routes.php';
+});
+
+return $app;
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..6de4efb
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,27 @@
+{
+ "name": "laravel/lumen",
+ "description": "The Laravel Lumen Framework.",
+ "keywords": ["framework", "laravel", "lumen"],
+ "license": "MIT",
+ "type": "project",
+ "require": {
+ "php": ">=5.5.9",
+ "laravel/lumen-framework": "5.2.*",
+ "vlucas/phpdotenv": "~2.2"
+ },
+ "require-dev": {
+ "fzaninotto/faker": "~1.4",
+ "phpunit/phpunit": "~4.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
+ }
+ },
+ "autoload-dev": {
+ "classmap": [
+ "tests/",
+ "database/"
+ ]
+ }
+}
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
new file mode 100644
index 0000000..b795b09
--- /dev/null
+++ b/database/factories/ModelFactory.php
@@ -0,0 +1,19 @@
+define(App\User::class, function ($faker) {
+ return [
+ 'name' => $faker->name,
+ 'email' => $faker->email,
+ ];
+});
diff --git a/database/migrations/.gitkeep b/database/migrations/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
new file mode 100644
index 0000000..603fab6
--- /dev/null
+++ b/database/seeds/DatabaseSeeder.php
@@ -0,0 +1,16 @@
+call('UserTableSeeder');
+ }
+}
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..77c29fe
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ ./tests/
+
+
+
+
+ app/
+
+
+
+
+
+
+
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..8eb2dd0
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,16 @@
+
+
+ Options -MultiViews
+
+
+ RewriteEngine On
+
+ # Redirect Trailing Slashes If Not A Folder...
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule ^(.*)/$ /$1 [L,R=301]
+
+ # Handle Front Controller...
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^ index.php [L]
+
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..04aa086
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,28 @@
+run();
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..9605e5f
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,21 @@
+## Lumen PHP Framework
+
+[](https://travis-ci.org/laravel/lumen-framework)
+[](https://packagist.org/packages/laravel/lumen-framework)
+[](https://packagist.org/packages/laravel/lumen-framework)
+[](https://packagist.org/packages/laravel/lumen-framework)
+[](https://packagist.org/packages/laravel/lumen-framework)
+
+Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
+
+## Official Documentation
+
+Documentation for the framework can be found on the [Lumen website](http://lumen.laravel.com/docs).
+
+## Security Vulnerabilities
+
+If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
+
+### License
+
+The Lumen framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
diff --git a/resources/views/.gitkeep b/resources/views/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/storage/app/.gitignore b/storage/app/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/storage/app/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/storage/framework/views/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/storage/logs/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php
new file mode 100644
index 0000000..2b206c6
--- /dev/null
+++ b/tests/ExampleTest.php
@@ -0,0 +1,20 @@
+get('/');
+
+ $this->assertEquals(
+ $this->response->getContent(), $this->app->version()
+ );
+ }
+}
diff --git a/tests/TestCase.php b/tests/TestCase.php
new file mode 100644
index 0000000..651d9cb
--- /dev/null
+++ b/tests/TestCase.php
@@ -0,0 +1,14 @@
+