Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Splinter Skeleton

Application template for the Splinter framework.

Create a new project

composer create-project splinter/skeleton my-service
cd my-service
cp .env.example .env   # already done automatically by composer

Edit .env, then run the migrations:

php splinter migrate

Start a local PHP server:

php -S localhost:8000 -t public/

Directory layout

bootstrap/app.php     Web bootstrap — boots HttpKernel
config/               Configuration files (auto-loaded by the kernel)
  app.php             Providers, routes, middlewares, extra commands
  database.php        Database connections
  events.php          Event → listener map
  phinx.php           Migration runner config (includes core migrations)
  queue.php           Redis connection for the queue driver
db/
  migrations/         Your application migrations
  seeds/              Seed files
public/index.php      Web server document root entry point
routes/
  api.php             API routes
  web.php             Web routes
splinter              CLI entry point (like artisan)
src/                  Your application code (App\ namespace)

CLI commands

php splinter migrate [--connection=default]
php splinter migrate:rollback [--connection=default]
php splinter migrate:status [--connection=default]
php splinter migrate:create <ClassName>
php splinter queue:work [queue]

Adding routes

Route files receive $app (Splinter\Application) and $router (Bramus\Router\Router) as local variables.

// routes/api.php
$router->mount('/api/v1', function () use ($router, $app) {
    $router->get('/ping', function () {
        \Splinter\Http\JsonResponse::success(['pong' => true])->send();
    });
});

Adding console commands

Register your command classes in config/app.php under 'commands'. They are resolved from the DI container, so constructor dependencies are autowired automatically.

About

Splinter application skeleton — deploy a new microservice with composer create-project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages