Repository: laravel/lumen
Branch: 10.x
Commit: b18a7652aa2d
Files: 37
Total size: 19.8 KB
Directory structure:
gitextract_h7oooe27/
├── .editorconfig
├── .gitignore
├── .styleci.yml
├── README.md
├── app/
│ ├── Console/
│ │ ├── Commands/
│ │ │ └── .gitkeep
│ │ └── Kernel.php
│ ├── Events/
│ │ ├── Event.php
│ │ └── ExampleEvent.php
│ ├── Exceptions/
│ │ └── Handler.php
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── Controller.php
│ │ │ └── ExampleController.php
│ │ └── Middleware/
│ │ ├── Authenticate.php
│ │ └── ExampleMiddleware.php
│ ├── Jobs/
│ │ ├── ExampleJob.php
│ │ └── Job.php
│ ├── Listeners/
│ │ └── ExampleListener.php
│ ├── Models/
│ │ └── User.php
│ └── Providers/
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ └── EventServiceProvider.php
├── artisan
├── bootstrap/
│ └── app.php
├── composer.json
├── database/
│ ├── factories/
│ │ └── UserFactory.php
│ ├── migrations/
│ │ └── .gitkeep
│ └── seeders/
│ └── DatabaseSeeder.php
├── phpunit.xml
├── public/
│ ├── .htaccess
│ └── index.php
├── resources/
│ └── views/
│ └── .gitkeep
├── routes/
│ └── web.php
├── storage/
│ ├── app/
│ │ └── .gitignore
│ ├── framework/
│ │ ├── cache/
│ │ │ └── .gitignore
│ │ └── views/
│ │ └── .gitignore
│ └── logs/
│ └── .gitignore
└── tests/
├── ExampleTest.php
└── TestCase.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
================================================
FILE: .gitignore
================================================
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
.phpunit.result.cache
================================================
FILE: .styleci.yml
================================================
php:
preset: laravel
disabled:
- unused_use
js: true
css: true
================================================
FILE: README.md
================================================
# 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)
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.
> **Note:** In the years since releasing Lumen, PHP has made a variety of wonderful performance improvements. For this reason, along with the availability of [Laravel Octane](https://laravel.com/docs/octane), we no longer recommend that you begin new projects with Lumen. Instead, we recommend always beginning new projects with [Laravel](https://laravel.com).
## Official Documentation
Documentation for the framework can be found on the [Lumen website](https://lumen.laravel.com/docs).
## Contributing
Thank you for considering contributing to Lumen! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Security Vulnerabilities
If you discover a security vulnerability within Lumen, 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](https://opensource.org/licenses/MIT).
================================================
FILE: app/Console/Commands/.gitkeep
================================================
================================================
FILE: app/Console/Kernel.php
================================================
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);
}
}
================================================
FILE: app/Http/Middleware/ExampleMiddleware.php
================================================
app['auth']->viaRequest('api', function ($request) {
if ($request->input('api_token')) {
return User::where('api_token', $request->input('api_token'))->first();
}
});
}
}
================================================
FILE: app/Providers/EventServiceProvider.php
================================================
[
\App\Listeners\ExampleListener::class,
],
];
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}
================================================
FILE: artisan
================================================
#!/usr/bin/env php
make(
'Illuminate\Contracts\Console\Kernel'
);
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
================================================
FILE: bootstrap/app.php
================================================
bootstrap();
date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
/*
|--------------------------------------------------------------------------
| 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(
dirname(__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 Config Files
|--------------------------------------------------------------------------
|
| Now we will register the "app" configuration file. If the file exists in
| your configuration directory it will be loaded; otherwise, we'll load
| the default version. You may register other files below as needed.
|
*/
$app->configure('app');
/*
|--------------------------------------------------------------------------
| 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->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
return $app;
================================================
FILE: composer.json
================================================
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"laravel/lumen-framework": "^10.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "stable",
"prefer-stable": true
}
================================================
FILE: database/factories/UserFactory.php
================================================
$this->faker->name,
'email' => $this->faker->unique()->safeEmail,
];
}
}
================================================
FILE: database/migrations/.gitkeep
================================================
================================================
FILE: database/seeders/DatabaseSeeder.php
================================================
call('UsersTableSeeder');
}
}
================================================
FILE: phpunit.xml
================================================
./tests
================================================
FILE: public/.htaccess
================================================
Options -MultiViews -Indexes
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
================================================
FILE: public/index.php
================================================
run();
================================================
FILE: resources/views/.gitkeep
================================================
================================================
FILE: routes/web.php
================================================
get('/', function () use ($router) {
return $router->app->version();
});
================================================
FILE: storage/app/.gitignore
================================================
*
!.gitignore
================================================
FILE: storage/framework/cache/.gitignore
================================================
*
!data/
!.gitignore
================================================
FILE: storage/framework/views/.gitignore
================================================
*
!.gitignore
================================================
FILE: storage/logs/.gitignore
================================================
*
!.gitignore
================================================
FILE: tests/ExampleTest.php
================================================
get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
================================================
FILE: tests/TestCase.php
================================================