basic conf for endpoints and local webserver to run

This commit is contained in:
Baptiste Lemoine 2019-11-05 12:16:16 +01:00
parent 3f4df3f92d
commit 8aa8be308e
7 changed files with 384 additions and 216 deletions

4
.gitignore vendored
View File

@ -10,3 +10,7 @@
### IDE
.idea
###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

View File

@ -5,6 +5,7 @@
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"friendsofsymfony/rest-bundle": "^2.6",
"jms/serializer-bundle": "^3.4",
"symfony/console": "4.3.*",
"symfony/dotenv": "4.3.*",
@ -17,7 +18,8 @@
"symfony/yaml": "4.3.*"
},
"require-dev": {
"symfony/maker-bundle": "^1.14"
"symfony/maker-bundle": "^1.14",
"symfony/web-server-bundle": "4.3.*"
},
"config": {
"preferred-install": {

510
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "59001106677984aa0feafbed283a2b9e",
"content-hash": "931f8f1912a751a5fd9cba28f6ff9c37",
"packages": [
{
"name": "doctrine/annotations",
@ -1208,6 +1208,108 @@
],
"time": "2018-06-14T14:45:07+00:00"
},
{
"name": "friendsofsymfony/rest-bundle",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git",
"reference": "54758949bff9fc520997415341323eebf3f54892"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/54758949bff9fc520997415341323eebf3f54892",
"reference": "54758949bff9fc520997415341323eebf3f54892",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.0",
"php": "^7.1",
"psr/log": "^1.0",
"symfony/config": "^3.4|^4.3",
"symfony/debug": "^3.4|^4.3",
"symfony/dependency-injection": "^3.4|^4.3",
"symfony/event-dispatcher": "^3.4|^4.3",
"symfony/finder": "^3.4|^4.3",
"symfony/framework-bundle": "^3.4|^4.3",
"symfony/http-foundation": "^3.4|^4.3",
"symfony/http-kernel": "^3.4|^4.3",
"symfony/routing": "^3.4|^4.3",
"symfony/security-core": "^3.4|^4.3",
"willdurand/jsonp-callback-validator": "^1.0",
"willdurand/negotiation": "^2.0"
},
"conflict": {
"jms/serializer": "<1.13.0",
"jms/serializer-bundle": "<2.0.0",
"sensio/framework-extra-bundle": "<3.0.13"
},
"require-dev": {
"jms/serializer": "^1.13|^2.0",
"jms/serializer-bundle": "^2.3.1|^3.0",
"phpoption/phpoption": "^1.1",
"psr/http-message": "^1.0",
"sensio/framework-extra-bundle": "^3.0.13|^4.0|^5.0",
"symfony/asset": "^3.4|^4.3",
"symfony/browser-kit": "^3.4|^4.3",
"symfony/css-selector": "^3.4|^4.3",
"symfony/expression-language": "^3.4|^4.3",
"symfony/form": "^3.4|^4.3",
"symfony/phpunit-bridge": "^4.1.8",
"symfony/security-bundle": "^3.4|^4.3",
"symfony/serializer": "^3.4|^4.3",
"symfony/templating": "^3.4|^4.3",
"symfony/twig-bundle": "^3.4|^4.3",
"symfony/validator": "^3.4|^4.3",
"symfony/web-profiler-bundle": "^3.4|^4.3",
"symfony/yaml": "^3.4|^4.3"
},
"suggest": {
"jms/serializer-bundle": "Add support for advanced serialization capabilities, recommended, requires ^2.0|^3.0",
"sensio/framework-extra-bundle": "Add support for the request body converter and the view response listener, requires ^3.0",
"symfony/expression-language": "Add support for using the expression language in the routing, requires ^2.7|^3.0",
"symfony/serializer": "Add support for basic serialization capabilities and xml decoding, requires ^2.7|^3.0",
"symfony/validator": "Add support for validation capabilities in the ParamFetcher, requires ^2.7|^3.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-4": {
"FOS\\RestBundle\\": ""
},
"exclude-from-classmap": [
"Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Lukas Kahwe Smith",
"email": "smith@pooteeweet.org"
},
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com"
},
{
"name": "FriendsOfSymfony Community",
"homepage": "https://github.com/friendsofsymfony/FOSRestBundle/contributors"
}
],
"description": "This Bundle provides various tools to rapidly develop RESTful API's with Symfony",
"homepage": "http://friendsofsymfony.github.com",
"keywords": [
"rest"
],
"time": "2019-10-21T08:22:30+00:00"
},
{
"name": "hoa/compiler",
"version": "3.17.08.08",
@ -4407,6 +4509,78 @@
],
"time": "2019-10-04T20:57:10+00:00"
},
{
"name": "symfony/security-core",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/security-core.git",
"reference": "a6f763c1f093b833d371f813519a1a8c07b75fb9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/security-core/zipball/a6f763c1f093b833d371f813519a1a8c07b75fb9",
"reference": "a6f763c1f093b833d371f813519a1a8c07b75fb9",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/event-dispatcher-contracts": "^1.1",
"symfony/service-contracts": "^1.1"
},
"conflict": {
"symfony/event-dispatcher": "<4.3",
"symfony/security-guard": "<4.3"
},
"require-dev": {
"psr/container": "^1.0",
"psr/log": "~1.0",
"symfony/event-dispatcher": "^4.3",
"symfony/expression-language": "~3.4|~4.0",
"symfony/http-foundation": "~3.4|~4.0",
"symfony/ldap": "~3.4|~4.0",
"symfony/validator": "^3.4.31|^4.3.4"
},
"suggest": {
"psr/container-implementation": "To instantiate the Security class",
"symfony/event-dispatcher": "",
"symfony/expression-language": "For using the expression voter",
"symfony/http-foundation": "",
"symfony/ldap": "For using LDAP integration",
"symfony/validator": "For using the user password constraint"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Security\\Core\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Security Component - Core Library",
"homepage": "https://symfony.com",
"time": "2019-09-10T11:22:25+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v1.1.7",
@ -4784,6 +4958,98 @@
"homepage": "https://symfony.com",
"time": "2019-09-11T15:41:19+00:00"
},
{
"name": "willdurand/jsonp-callback-validator",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/willdurand/JsonpCallbackValidator.git",
"reference": "1a7d388bb521959e612ef50c5c7b1691b097e909"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/willdurand/JsonpCallbackValidator/zipball/1a7d388bb521959e612ef50c5c7b1691b097e909",
"reference": "1a7d388bb521959e612ef50c5c7b1691b097e909",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
},
"type": "library",
"autoload": {
"psr-0": {
"JsonpCallbackValidator": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "William Durand",
"email": "william.durand1@gmail.com",
"homepage": "http://www.willdurand.fr"
}
],
"description": "JSONP callback validator.",
"time": "2014-01-20T22:35:06+00:00"
},
{
"name": "willdurand/negotiation",
"version": "v2.3.1",
"source": {
"type": "git",
"url": "https://github.com/willdurand/Negotiation.git",
"reference": "03436ededa67c6e83b9b12defac15384cb399dc9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/willdurand/Negotiation/zipball/03436ededa67c6e83b9b12defac15384cb399dc9",
"reference": "03436ededa67c6e83b9b12defac15384cb399dc9",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-4": {
"Negotiation\\": "src/Negotiation"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "William Durand",
"email": "will+git@drnd.me"
}
],
"description": "Content Negotiation tools for PHP provided as a standalone library.",
"homepage": "http://williamdurand.fr/Negotiation/",
"keywords": [
"accept",
"content",
"format",
"header",
"negotiation"
],
"time": "2017-05-14T17:21:12+00:00"
},
{
"name": "zendframework/zend-code",
"version": "3.4.0",
@ -4893,108 +5159,6 @@
}
],
"packages-dev": [
{
"name": "friendsofsymfony/rest-bundle",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git",
"reference": "54758949bff9fc520997415341323eebf3f54892"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/54758949bff9fc520997415341323eebf3f54892",
"reference": "54758949bff9fc520997415341323eebf3f54892",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.0",
"php": "^7.1",
"psr/log": "^1.0",
"symfony/config": "^3.4|^4.3",
"symfony/debug": "^3.4|^4.3",
"symfony/dependency-injection": "^3.4|^4.3",
"symfony/event-dispatcher": "^3.4|^4.3",
"symfony/finder": "^3.4|^4.3",
"symfony/framework-bundle": "^3.4|^4.3",
"symfony/http-foundation": "^3.4|^4.3",
"symfony/http-kernel": "^3.4|^4.3",
"symfony/routing": "^3.4|^4.3",
"symfony/security-core": "^3.4|^4.3",
"willdurand/jsonp-callback-validator": "^1.0",
"willdurand/negotiation": "^2.0"
},
"conflict": {
"jms/serializer": "<1.13.0",
"jms/serializer-bundle": "<2.0.0",
"sensio/framework-extra-bundle": "<3.0.13"
},
"require-dev": {
"jms/serializer": "^1.13|^2.0",
"jms/serializer-bundle": "^2.3.1|^3.0",
"phpoption/phpoption": "^1.1",
"psr/http-message": "^1.0",
"sensio/framework-extra-bundle": "^3.0.13|^4.0|^5.0",
"symfony/asset": "^3.4|^4.3",
"symfony/browser-kit": "^3.4|^4.3",
"symfony/css-selector": "^3.4|^4.3",
"symfony/expression-language": "^3.4|^4.3",
"symfony/form": "^3.4|^4.3",
"symfony/phpunit-bridge": "^4.1.8",
"symfony/security-bundle": "^3.4|^4.3",
"symfony/serializer": "^3.4|^4.3",
"symfony/templating": "^3.4|^4.3",
"symfony/twig-bundle": "^3.4|^4.3",
"symfony/validator": "^3.4|^4.3",
"symfony/web-profiler-bundle": "^3.4|^4.3",
"symfony/yaml": "^3.4|^4.3"
},
"suggest": {
"jms/serializer-bundle": "Add support for advanced serialization capabilities, recommended, requires ^2.0|^3.0",
"sensio/framework-extra-bundle": "Add support for the request body converter and the view response listener, requires ^3.0",
"symfony/expression-language": "Add support for using the expression language in the routing, requires ^2.7|^3.0",
"symfony/serializer": "Add support for basic serialization capabilities and xml decoding, requires ^2.7|^3.0",
"symfony/validator": "Add support for validation capabilities in the ParamFetcher, requires ^2.7|^3.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-4": {
"FOS\\RestBundle\\": ""
},
"exclude-from-classmap": [
"Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Lukas Kahwe Smith",
"email": "smith@pooteeweet.org"
},
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com"
},
{
"name": "FriendsOfSymfony Community",
"homepage": "https://github.com/friendsofsymfony/FOSRestBundle/contributors"
}
],
"description": "This Bundle provides various tools to rapidly develop RESTful API's with Symfony",
"homepage": "http://friendsofsymfony.github.com",
"keywords": [
"rest"
],
"time": "2019-10-21T08:22:30+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.2.4",
@ -5193,44 +5357,21 @@
"time": "2019-10-21T12:43:48+00:00"
},
{
"name": "symfony/security-core",
"version": "v4.3.5",
"name": "symfony/process",
"version": "v4.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/security-core.git",
"reference": "a6f763c1f093b833d371f813519a1a8c07b75fb9"
"url": "https://github.com/symfony/process.git",
"reference": "3b2e0cb029afbb0395034509291f21191d1a4db0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/security-core/zipball/a6f763c1f093b833d371f813519a1a8c07b75fb9",
"reference": "a6f763c1f093b833d371f813519a1a8c07b75fb9",
"url": "https://api.github.com/repos/symfony/process/zipball/3b2e0cb029afbb0395034509291f21191d1a4db0",
"reference": "3b2e0cb029afbb0395034509291f21191d1a4db0",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/event-dispatcher-contracts": "^1.1",
"symfony/service-contracts": "^1.1"
},
"conflict": {
"symfony/event-dispatcher": "<4.3",
"symfony/security-guard": "<4.3"
},
"require-dev": {
"psr/container": "^1.0",
"psr/log": "~1.0",
"symfony/event-dispatcher": "^4.3",
"symfony/expression-language": "~3.4|~4.0",
"symfony/http-foundation": "~3.4|~4.0",
"symfony/ldap": "~3.4|~4.0",
"symfony/validator": "^3.4.31|^4.3.4"
},
"suggest": {
"psr/container-implementation": "To instantiate the Security class",
"symfony/event-dispatcher": "",
"symfony/expression-language": "For using the expression voter",
"symfony/http-foundation": "",
"symfony/ldap": "For using LDAP integration",
"symfony/validator": "For using the user password constraint"
"php": "^7.1.3"
},
"type": "library",
"extra": {
@ -5240,7 +5381,7 @@
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Security\\Core\\": ""
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
@ -5260,80 +5401,50 @@
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Security Component - Core Library",
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-09-10T11:22:25+00:00"
"time": "2019-10-28T17:07:32+00:00"
},
{
"name": "willdurand/jsonp-callback-validator",
"version": "v1.1.0",
"name": "symfony/web-server-bundle",
"version": "v4.3.6",
"source": {
"type": "git",
"url": "https://github.com/willdurand/JsonpCallbackValidator.git",
"reference": "1a7d388bb521959e612ef50c5c7b1691b097e909"
"url": "https://github.com/symfony/web-server-bundle.git",
"reference": "dc26b980900ddf3e9feade14e5b21c029e8ca92f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/willdurand/JsonpCallbackValidator/zipball/1a7d388bb521959e612ef50c5c7b1691b097e909",
"reference": "1a7d388bb521959e612ef50c5c7b1691b097e909",
"url": "https://api.github.com/repos/symfony/web-server-bundle/zipball/dc26b980900ddf3e9feade14e5b21c029e8ca92f",
"reference": "dc26b980900ddf3e9feade14e5b21c029e8ca92f",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": "^7.1.3",
"symfony/config": "~3.4|~4.0",
"symfony/console": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/polyfill-ctype": "~1.8",
"symfony/process": "^3.4.2|^4.0.2"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
"suggest": {
"symfony/expression-language": "For using the filter option of the log server.",
"symfony/monolog-bridge": "For using the log server."
},
"type": "library",
"autoload": {
"psr-0": {
"JsonpCallbackValidator": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "William Durand",
"email": "william.durand1@gmail.com",
"homepage": "http://www.willdurand.fr"
}
],
"description": "JSONP callback validator.",
"time": "2014-01-20T22:35:06+00:00"
},
{
"name": "willdurand/negotiation",
"version": "v2.3.1",
"source": {
"type": "git",
"url": "https://github.com/willdurand/Negotiation.git",
"reference": "03436ededa67c6e83b9b12defac15384cb399dc9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/willdurand/Negotiation/zipball/03436ededa67c6e83b9b12defac15384cb399dc9",
"reference": "03436ededa67c6e83b9b12defac15384cb399dc9",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
},
"type": "library",
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "4.3-dev"
}
},
"autoload": {
"psr-4": {
"Negotiation\\": "src/Negotiation"
}
"Symfony\\Bundle\\WebServerBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -5341,20 +5452,17 @@
],
"authors": [
{
"name": "William Durand",
"email": "will+git@drnd.me"
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Content Negotiation tools for PHP provided as a standalone library.",
"homepage": "http://williamdurand.fr/Negotiation/",
"keywords": [
"accept",
"content",
"format",
"header",
"negotiation"
],
"time": "2017-05-14T17:21:12+00:00"
"description": "Symfony WebServerBundle",
"homepage": "https://symfony.com",
"time": "2019-08-20T14:27:59+00:00"
}
],
"aliases": [],

View File

@ -9,4 +9,5 @@ return [
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
];

View File

@ -1,15 +1,18 @@
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
fos_rest: null
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
# format_listener:
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
fos_rest:
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
format_listener:
rules:
- { path: '^/',
prefer_extension: true,
fallback_format: json,
priorities: [ json, html ] }

View File

@ -0,0 +1,38 @@
<?php
namespace App\Controller;
use FOS\RestBundle\Controller\Annotations\Get;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Class DefaultController
* @package App\Controller
* @Route("/api",name="api_")
*/
class DefaultController extends AbstractController {
/**
* @Get(path ="/",
* name = "app_get_default")
*/
public function index() {
return $this->json( [
'message' => 'Welcome to your new controller!',
'path' => 'src/Controller/DefaultController.php',
] );
}
/**
* @Get(
* path = "/my-polls",
* name = "app_get_my_polls",
* requirements = {"access_token"="\w+"}
* )
*/
public function showMyPollsAction() {
return $this->json( [
'message' => 'here are your polls',
] );
}
}

View File

@ -307,6 +307,9 @@
"symfony/polyfill-php73": {
"version": "v1.12.0"
},
"symfony/process": {
"version": "v4.3.6"
},
"symfony/property-access": {
"version": "v4.3.5"
},
@ -352,6 +355,15 @@
"symfony/var-exporter": {
"version": "v4.3.5"
},
"symfony/web-server-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a"
}
},
"symfony/yaml": {
"version": "v4.3.5"
},