Skip to content

tarlepp/silex-backend

Repository files navigation

What is this?

Simple JSON API which is build on top of Silex framework.

Main points

  • This is just an API, nothing else
  • Only JSON responses from API
  • JWT authentication

TODO

  • Configuration for each environment and/or developer
  • Authentication via JWT
  • "Automatic" API doc generation
  • Database connection (Doctrine dbal + orm)
  • Console tools (dbal, migrations, orm)
  • Docker support
  • [ ]
  • [ ]
  • [ ]

Requirements

  • PHP 5.5.x
  • Apache / nginx / IIS / Lighttpd see configuration information here

Development

  • Use your favorite IDE and get checkout from git
  • Open terminal, go to folder where you make that checkout and run following commands
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install

Installation

  • Open terminal and clone this repository to your server
  • Create web-server configuration which points to web folder
  • Ensure that var folder is writable by web-server user

Configuration

Add your local.yml configuration file to some (or all) following directories:

  • resources/config/common
  • resources/config/dev
  • resources/config/prod
  • resources/config/cli-dev
  • resources/config/cli-prod

Within this file you can override any environment or common configuration value as you like. Basically first thing to do is define your database settings - without these you can't basically do anything...

Database initialization

This can be done with following command:

./bin/console migrations:migrate

Possible "failures"

  • Missing var directory? Create it and check that it has proper write access in other words just do chmod 777 var

Nice to know things

GET http://yoururl/_dump

  • generates pimple.json for autocomplete
  • See this for more info

./bin/console orm:convert:mapping --from-database --namespace="App\\Entities\\" annotation ./src

  • Generate Doctrine entities from database

Contributing

Please see the CONTRIBUTING.md file for guidelines.

Author

Tarmo Leppänen

LICENSE

The MIT License (MIT)

Copyright (c) 2016 Tarmo Leppänen

About

REST API with Silex

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published