2017 © Pedro Peláez
 

project silex-bootstrap

Bootstrap for Silex based API

image

mareksokol/silex-bootstrap

Bootstrap for Silex based API

  • Sunday, December 3, 2017
  • by templar1
  • Repository
  • 1 Watchers
  • 3 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Silex-bootstrap

Build Status, (*1)

Silex-bootstrap is an already setup Silex project dedicated for lightweight, RESTful APIs., (*2)

Installation

To start a new project, run:, (*3)

composer create-project mareksokol/silex-bootstrap <target-dir>

You need also to create config file in root directory:, (*4)

cp config.php.dist config.php

Directory structure

The directory structure is the following, (*5)

bin/
src/
  Controller/
  Entity/
    Migrations/
    Repository/
  Service/
    Provider/
storage/
    logs/
    proxies/
tests/
web/

bin/ place for all executables, eg. command line tool, (*6)

src/ is the root of application, contains application files: controllers, entities, migrations, repositories, services, providers and bootstrap file, (*7)

storage/ all static files, including application logs, (*8)

test/ contains unit tests, (*9)

web/ contains everything which is exposed - HTTP server should be configured to point this place as root, (*10)

Usage

Configuration

All configuration should be places in config.php file. To define new configuration parameters need to add definition in App\Service\Provider\ConfigServiceProvider::$config., (*11)

Controllers

Controllers should inherit from App\Controller\AbstractController - this class implements several helper methods to simplify output from API. To register new controller need to add declaration in App\Bootstrap::loadControllers()., (*12)

Routes

Routes are defined in App\Bootstrap::routes()., (*13)

Services

Services are registered via service providers in App\Bootstrap::loadServices(). Custom service providers should be placed in App\Service\Provider namespace., (*14)

Database

All database mechanism is based on Doctrine2 framework. There is dedicated namespace App\Entity for all doctrine classes (entities, repositories: App\Entity\Repository and migrations: App\Entity\Migrations)., (*15)

The Versions