Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2010-2017 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
47 changes: 47 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Silex Application


* use the silex-app.sql to create the data base.
* change the config/prod.php configuration to connect the database.

start the server through line command by navigating to the application folder and typing `php -S localhost:7575 web/index.php`.


## Endpoints

Method|URL|SEGMENT|Params|Description
|-------|------:|-------:|-------:|--------:|
|GET|localhost:7575/api/v1 | /people | null | retrieve a list of all registers
|GET|localhost:7575/api/v1 | /people | /id | retrieve the information about one register
|POST|localhost:7575/api/v1 | /people | /{json data} | insert a new register on the database.
|PUT|localhost:7575/api/v1 | /people | / {json data} | update a register on the database.
|DELETE|localhost:7575/api/v1 | people | /id | delete a register on the data base.


## The JSON Object

The JSON object to be used on the insert and update methods should follow this structure:

```javascript
{
"id" : "the id of the register (only informed when is a update)",
"name" : "The Name of the person",
"email" : "The Email of the person",
"active" : "wheter the person is active or not. (1 - active, 0 - inactive)",
"job" : "the job of the related person",
"about" : "the description about this person"
}
```


## The Authorizarion Code

To be able to connect to the api you need to inform on the header of the request the authorization code. You cand create one direct on the database table users, from the start you can use the following code `0b39ec2ea2d9626c485942280bea3993`.

A valid request should look like this:
```
Authorization: 0b39ec2ea2d9626c485942280bea3993
Content-Type: json/application
Body: {json object}
....
```
16 changes: 16 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env php
<?php

require_once __DIR__.'/../vendor/autoload.php';

set_time_limit(0);

use Symfony\Component\Console\Input\ArgvInput;

$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');

$app = require __DIR__.'/../src/app.php';
require __DIR__.'/../config/'.$env.'.php';
$console = require __DIR__.'/../src/console.php';
$console->run();
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "fabpot/silex-skeleton",
"description": "A pre-configured skeleton for the Silex microframework",
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"silex/silex": "~2.0",
"silex/web-profiler": "~2.0",
"symfony/asset": "~2.8|^3.0",
"symfony/browser-kit": "~2.8|^3.0",
"symfony/class-loader": "~2.8|^3.0",
"symfony/config": "~2.8|^3.0",
"symfony/console": "~2.8|^3.0",
"symfony/css-selector": "~2.8|^3.0",
"symfony/debug": "~2.8|^3.0",
"symfony/finder": "~2.8|^3.0",
"symfony/form": "~2.8|^3.0",
"symfony/monolog-bridge": "~2.8|^3.0",
"symfony/process": "~2.8|^3.0",
"symfony/security": "~2.8|^3.0",
"symfony/translation": "~2.8|^3.0",
"symfony/twig-bridge": "~2.8|^3.0",
"symfony/validator": "~2.8|^3.0",
"doctrine/dbal": "~2.2"
},
"autoload": {
"psr-0": { "": "src/" }
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"scripts": {
"run": [
"echo 'Started web server on http://localhost:8888'",
"php -S localhost:8888 -t web"
]
}
}
Loading