Skip to content

Instantly share code, notes, and snippets.

@hochun836
Last active July 4, 2021 23:54
Show Gist options
  • Select an option

  • Save hochun836/645caac2ea0302a113ce1a7d78566320 to your computer and use it in GitHub Desktop.

Select an option

Save hochun836/645caac2ea0302a113ce1a7d78566320 to your computer and use it in GitHub Desktop.
# directory & file
app // include Console, Events, Exceptions, Http (Controllers/Middleware), Jobs, Listeners, Models, Providers
bootstrap/app.php // instantiate lumen application
config // default: vendor/laravel/lumen-framework/config (include app.php, auth.php, logging.php ...)
public/index.php // there is a .htaccess in the same level
routes/web.php
vendor // dependencies
.env // after loaded, get by function env($key, $default = null)
artisan // #!/usr/bin/env php
composer.json // like npm package.json
# lumen application (abbr. app)
=> file: vendor/laravel/lumen-framework/src/Application.php
class Application extends Container // IoC Container
use Concerns\RoutesRequests, // trait
Concerns\RegistersExceptionHandlers
# Container
=> file: vendor/illuminate/container/Container.php
class Container implements ArrayAccess, ContainerContract
protected static $instance;
protected $resolved = [];
protected $bindings = [];
protected $instances = [];
protected $aliases = [];
...
public function bound($abstract)
public function has($id)
public function resolved($abstract)
public function bind($abstract, $concrete = null, $shared = false)
public function bindIf($abstract, $concrete = null, $shared = false)
public function singleton($abstract, $concrete = null)
public function singletonIf($abstract, $concrete = null)
public function instance($abstract, $instance)
public function rebinding($abstract, Closure $callback)
public function refresh($abstract, $target, $method)
protected function rebound($abstract)
public function make($abstract, array $parameters = [])
public function get($id)
protected function resolve($abstract, $parameters = [], $raiseEvents = true)
public function build($concrete)
...
# RoutesRequests
=> file: vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php
trait RoutesRequests
protected $middleware = [];
protected $routeMiddleware = [];
protected $currentRoute;
protected $dispatcher;
public function middleware($middleware)
public function routeMiddleware(array $middleware)
public function handle(SymfonyRequest $request)
public function run($request = null)
public function dispatch($request = null)
protected function parseIncomingRequest($request)
...
# helper
=> file: vendor/illuminate/support/helpers.php
function append_config, blank, class_basename, class_uses_recursive, env, filled, object_get ...
=> ref: https://laravel.com/docs/master/helpers
# service provider
class XXX extends ServiceProvider // ServiceProvider is abstract class
function register // this method is called to bind things into the service container
function boot // this method is called after all other service providers have been registered
=> ref: https://lumen.laravel.com/docs/8.x/providers
# auth
=> file:
app/Http/Middleware/Authenticate.php
app/Providers/AuthServiceProvider.php
vendor/laravel/lumen-framework/config/auth.php
vendor/illuminate/auth/AuthManager.php
vendor/illuminate/auth/RequestGuard.php
vendor/illuminate/auth/GuardHelpers.php
=> ref: https://medium.com/wake/lumen-auth-guard-user-%E7%99%BB%E5%85%A5%E9%A9%97%E8%AD%89%E8%A9%B3%E8%A7%A3-%E4%B8%80-authentication-%E6%96%87%E4%BB%B6%E5%9C%A8%E5%BF%99%E4%BB%80%E9%BA%BC-de7df40510f5
# [note] how do lumen use composer autoload
=> file: bootstrap/app.php
require_once __DIR__ . '/../vendor/autoload.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment