diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0a9a047 --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +Order Allow,Deny +Deny from all diff --git a/app/Controllers/AbstractController.php b/app/Controllers/AbstractController.php new file mode 100644 index 0000000..169dfb6 --- /dev/null +++ b/app/Controllers/AbstractController.php @@ -0,0 +1,24 @@ +apiResponseFormatter = $apiResponseFormatter; + } + +} diff --git a/app/Controllers/ErrorController.php b/app/Controllers/ErrorController.php new file mode 100644 index 0000000..a9bd782 --- /dev/null +++ b/app/Controllers/ErrorController.php @@ -0,0 +1,26 @@ +getParameter('exception'); + + /** + * @todo Log exception + */ + + return new ApiResponse($this->apiResponseFormatter->formatException($exception)); + } + +} diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php new file mode 100644 index 0000000..90dfa4a --- /dev/null +++ b/app/Controllers/LoginController.php @@ -0,0 +1,32 @@ +apiResponseFormatter->formatMessage('Hello')); + } + +} diff --git a/app/Http/ApiResponse.php b/app/Http/ApiResponse.php new file mode 100644 index 0000000..dc73010 --- /dev/null +++ b/app/Http/ApiResponse.php @@ -0,0 +1,11 @@ + 'ok', + 'payload' => [ + 'message' => $message + ] + ]; + } + + + public function formatPayload(array $payload): array + { + return [ + 'status' => 'ok', + 'payload' => $payload + ]; + } + + + public function formatException(\Exception $e): array + { + return [ + 'status' => 'error', + 'code' => $e->getCode(), + 'message' => $e->getMessage() + ]; + } + +} diff --git a/app/Routing/RouterFactory.php b/app/Routing/RouterFactory.php new file mode 100644 index 0000000..95fea4c --- /dev/null +++ b/app/Routing/RouterFactory.php @@ -0,0 +1,19 @@ +setDebugMode(FALSE); +$configurator->enableTracy(__DIR__ . '/../log'); + +$configurator->setTimeZone('Europe/Prague'); +$configurator->setTempDirectory(__DIR__ . '/../temp'); + +$configurator->addConfig(__DIR__ . '/config/config.neon'); + +if (file_exists(__DIR__ . '/config/config.local.neon')) { + $configurator->addConfig(__DIR__ . '/config/config.local.neon'); +} + +$container = $configurator->createContainer(); + +return $container; diff --git a/app/config/config.neon b/app/config/config.neon new file mode 100644 index 0000000..93c70e0 --- /dev/null +++ b/app/config/config.neon @@ -0,0 +1,26 @@ +extensions: + apiRouter: Ublaboo\ApiRouter\DI\ApiRouterExtension + + +parameters: + + +application: + errorPresenter: Error + scanDirs: false + mapping: + *: App\Controllers\*Controller + + +session: + expiration: 14 days + + +services: + - App\Http\ApiResponseFormatter + - App\Routing\RouterFactory + router: @App\Routing\RouterFactory::create + + # Api endpoints + # + - App\Controllers\LoginController diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..a50e90b --- /dev/null +++ b/composer.json @@ -0,0 +1,38 @@ +{ + "name": "ublaboo/api-router-project", + "type": "project", + "description": "Example starter project for ublaboo/api-router", + "keywords": ["rest", "api", "routes", "nette", "router", "restapi", "restrouter", "routing", "route", "starter", "project", "example"], + "homepage": "https://github.com/ublaboo/api-router-project", + "license": ["MIT"], + "support": { + "issues": "https://github.com/ublaboo/api-router-project/issues" + }, + "authors": [ + { + "name": "Pavel Janda", + "homepage": "http://paveljanda.com" + } + ], + "require": { + "php": ">= 7.1", + "nette/application": "^2.4", + "nette/bootstrap": "^2.4.2", + "nette/caching": "^2.5", + "nette/di": "^2.4", + "nette/http": "^2.4", + "nette/security": "^2.4", + "nette/utils": "^2.4", + "tracy/tracy": "^2.4", + "ublaboo/api-router": "^1.2" + }, + "require-dev": { + "nette/tester": "^1.6" + }, + "autoload": { + "psr-4": { + "App\\": "app" + } + }, + "minimum-stability": "stable" +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..4ca1be5 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1254 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "4f85f5d8881a2efb9aa2b3bea90e0a98", + "content-hash": "22f7fbb55553664661f96db4fa9ac236", + "packages": [ + { + "name": "doctrine/annotations", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-02-24 16:22:25" + }, + { + "name": "doctrine/cache", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2016-10-29 11:16:17" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09 13:34:57" + }, + { + "name": "latte/latte", + "version": "v2.4.4", + "source": { + "type": "git", + "url": "https://github.com/nette/latte.git", + "reference": "7d207e620cfc1386fb7ccd8de403d5760f7ca655" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/latte/zipball/7d207e620cfc1386fb7ccd8de403d5760f7ca655", + "reference": "7d207e620cfc1386fb7ccd8de403d5760f7ca655", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=5.4.4" + }, + "conflict": { + "nette/application": "<2.4.1" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-fileinfo": "to use filter |datastream", + "ext-mbstring": "to use filters like lower, upper, capitalize, ..." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Latte: the amazing template engine for PHP", + "homepage": "https://latte.nette.org", + "keywords": [ + "templating", + "twig" + ], + "time": "2017-05-17 12:00:19" + }, + { + "name": "nette/application", + "version": "v2.4.6", + "source": { + "type": "git", + "url": "https://github.com/nette/application.git", + "reference": "057f5bd271ee0969570c49fc4ff1e3cb4e3fd113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/application/zipball/057f5bd271ee0969570c49fc4ff1e3cb4e3fd113", + "reference": "057f5bd271ee0969570c49fc4ff1e3cb4e3fd113", + "shasum": "" + }, + "require": { + "nette/component-model": "^2.3", + "nette/http": "^2.2", + "nette/reflection": "^2.2", + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/di": "<2.4", + "nette/forms": "<2.4", + "nette/latte": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "^2.4.3", + "mockery/mockery": "^0.9.5", + "nette/di": "^2.4 || ~3.0.0", + "nette/forms": "^2.4", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/security": "^2.4", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "latte/latte": "Allows using Latte in templates", + "nette/forms": "Allows to use Nette\\Application\\UI\\Form" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/compatibility.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Application MVC Component", + "homepage": "https://nette.org", + "time": "2017-05-23 11:59:42" + }, + { + "name": "nette/bootstrap", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/2c27747f5aff2e436ebf542e0ea566bea1db2d53", + "reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.7", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Bootstrap", + "homepage": "https://nette.org", + "time": "2017-02-19 22:15:02" + }, + { + "name": "nette/caching", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/nette/caching.git", + "reference": "2436e530484a346d0a246733519ceaa40b943bd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/caching/zipball/2436e530484a346d0a246733519ceaa40b943bd6", + "reference": "2436e530484a346d0a246733519ceaa40b943bd6", + "shasum": "" + }, + "require": { + "nette/finder": "^2.2 || ~3.0.0", + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "^2.4", + "nette/di": "^2.4 || ~3.0.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Caching Component", + "homepage": "https://nette.org", + "time": "2017-01-29 20:40:55" + }, + { + "name": "nette/component-model", + "version": "v2.3.0", + "source": { + "type": "git", + "url": "https://github.com/nette/component-model.git", + "reference": "9b5817b246bf409b8f0f8309c23e599dd8729d28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/component-model/zipball/9b5817b246bf409b8f0f8309c23e599dd8729d28", + "reference": "9b5817b246bf409b8f0f8309c23e599dd8729d28", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/application": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Component Model", + "homepage": "https://nette.org", + "time": "2016-06-17 17:36:56" + }, + { + "name": "nette/di", + "version": "v2.4.8", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "b3fe8551162279216e251e49b406e55cd2d255d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/b3fe8551162279216e251e49b406e55cd2d255d5", + "reference": "b3fe8551162279216e251e49b406e55cd2d255d5", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/neon": "^2.3.3 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/utils": "^2.4.3 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Dependency Injection Component", + "homepage": "https://nette.org", + "time": "2017-03-14 17:16:14" + }, + { + "name": "nette/finder", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Finder: Files Searching", + "homepage": "https://nette.org", + "time": "2016-05-17 15:49:06" + }, + { + "name": "nette/http", + "version": "v2.4.5", + "source": { + "type": "git", + "url": "https://github.com/nette/http.git", + "reference": "ef812049a89866eff5aa6b1a39f1a4d8c9adc607" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/http/zipball/ef812049a89866eff5aa6b1a39f1a4d8c9adc607", + "reference": "ef812049a89866eff5aa6b1a39f1a4d8c9adc607", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "^2.4.6 || ~3.0.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-fileinfo": "to detect type of uploaded files", + "nette/security": "allows use Nette\\Http\\UserStorage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette HTTP Component", + "homepage": "https://nette.org", + "time": "2017-03-16 15:43:45" + }, + { + "name": "nette/neon", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/1a78ff64b1e161ebccc03bdf9366450a69365f5b", + "reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette NEON: parser & generator for Nette Object Notation", + "homepage": "http://ne-on.org", + "time": "2017-01-13 08:00:19" + }, + { + "name": "nette/php-generator", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/8605fd18857a4beef4aa0afc19eb9a7f876237e8", + "reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Generates neat PHP code for you. Supports new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2017-03-18 15:20:10" + }, + { + "name": "nette/reflection", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/reflection.git", + "reference": "ca6bafe1f73c19719238b58f91e6a399f281069b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/reflection/zipball/ca6bafe1f73c19719238b58f91e6a399f281069b", + "reference": "ca6bafe1f73c19719238b58f91e6a399f281069b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/caching": "^2.2 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "^2.4 || ^3.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette PHP Reflection Component", + "homepage": "https://nette.org", + "time": "2017-01-10 16:10:27" + }, + { + "name": "nette/security", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/security.git", + "reference": "e547c81b36bae6cb5a6ba0c498314940f5d428ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/security/zipball/e547c81b36bae6cb5a6ba0c498314940f5d428ed", + "reference": "e547c81b36bae6cb5a6ba0c498314940f5d428ed", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "~2.4", + "nette/http": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Security: Access Control Component", + "homepage": "https://nette.org", + "time": "2016-12-19 10:53:40" + }, + { + "name": "nette/utils", + "version": "v2.4.6", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/266160aec0d99516e0ea510de1dfa24a0dc1e76e", + "reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Utility Classes", + "homepage": "https://nette.org", + "time": "2017-04-26 10:04:49" + }, + { + "name": "tracy/tracy", + "version": "v2.4.7", + "source": { + "type": "git", + "url": "https://github.com/nette/tracy.git", + "reference": "e9e93b778a75760a939593384e326fb65f9a0da2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/tracy/zipball/e9e93b778a75760a939593384e326fb65f9a0da2", + "reference": "e9e93b778a75760a939593384e326fb65f9a0da2", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-session": "*", + "php": ">=5.4.4" + }, + "require-dev": { + "nette/di": "~2.3", + "nette/tester": "~2.0" + }, + "suggest": { + "https://nette.org/donate": "\u001b[1;37;42m Please consider supporting Tracy via a donation \u001b[0m" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src" + ], + "files": [ + "src/shortcuts.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", + "homepage": "https://tracy.nette.org", + "keywords": [ + "Xdebug", + "debug", + "debugger", + "nette", + "profiler" + ], + "time": "2017-05-11 14:28:35" + }, + { + "name": "ublaboo/api-docu", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/ublaboo/api-docu.git", + "reference": "e3f6c6724b5a7b95c35b953ca8fac9aec9d06aa4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ublaboo/api-docu/zipball/e3f6c6724b5a7b95c35b953ca8fac9aec9d06aa4", + "reference": "e3f6c6724b5a7b95c35b953ca8fac9aec9d06aa4", + "shasum": "" + }, + "require": { + "latte/latte": "^2.3|^2.4", + "nette/application": "^2.3|^2.4", + "nette/di": "^2.3|^2.4", + "nette/http": "^2.3|^2.4", + "ublaboo/api-router": ">=1.2.5" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "nette/tester": "~1.6.1", + "tracy/tracy": "^2.3|^2.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ublaboo\\ApiDocu\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pavel Janda", + "homepage": "http://paveljanda.com" + } + ], + "description": "Documentation generating for ApiRouter routes - awesome runtime documentation", + "homepage": "http://ublaboo.paveljanda.com/api-docu", + "keywords": [ + "api", + "apidocu", + "docu", + "documentation", + "nette", + "rest", + "routes" + ], + "time": "2016-09-21 11:52:36" + }, + { + "name": "ublaboo/api-router", + "version": "v1.2.8", + "source": { + "type": "git", + "url": "https://github.com/ublaboo/api-router.git", + "reference": "c91fa0a2cb0f328385635b0f2c11bfe0524ed408" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ublaboo/api-router/zipball/c91fa0a2cb0f328385635b0f2c11bfe0524ed408", + "reference": "c91fa0a2cb0f328385635b0f2c11bfe0524ed408", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.2.0", + "doctrine/cache": "~1.6.0", + "nette/application": "^2.3|^2.4", + "nette/di": "^2.3|^2.4", + "nette/http": "^2.3|^2.4", + "nette/reflection": "^2.3|^2.4", + "nette/utils": "^2.3|^2.4" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "nette/tester": "~1.6.1", + "tracy/tracy": "^2.3|^2.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ublaboo\\ApiRouter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pavel Janda", + "homepage": "http://paveljanda.com" + } + ], + "description": "RESTful Router for your Apis in Nette Framework - created either directly or via annotation", + "homepage": "http://ublaboo.paveljanda.com/api-router", + "keywords": [ + "api", + "nette", + "rest", + "restapi", + "restrouter", + "route", + "router", + "routes", + "routing" + ], + "time": "2016-12-20 13:52:08" + } + ], + "packages-dev": [ + { + "name": "nette/tester", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/nette/tester.git", + "reference": "d97534578e8cf66eabe081e7d5eaa4dd527ab0c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/tester/zipball/d97534578e8cf66eabe081e7d5eaa4dd527ab0c8", + "reference": "d97534578e8cf66eabe081e7d5eaa4dd527ab0c8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "bin": [ + "src/tester" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "An easy-to-use PHP unit testing framework.", + "homepage": "https://tester.nette.org", + "keywords": [ + "nette", + "testing", + "unit" + ], + "time": "2016-03-19 14:34:02" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">= 7.1" + }, + "platform-dev": [] +} diff --git a/log/.gitignore b/log/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..893b876 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +# ApiRouter Example Project + +This repository is a meant as a starter project for [ublaboo/api-router](https://github.com/ublaboo/api-router). + +## Requirements + +PHP 7.1 or higher. + + +## ublaboo/api-router-project usage + + composer create-project ublaboo/api-router-project + diff --git a/temp/.gitignore b/temp/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/temp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/www/.htaccess b/www/.htaccess new file mode 100644 index 0000000..4cfc52e --- /dev/null +++ b/www/.htaccess @@ -0,0 +1,28 @@ +# Apache configuration file (see https://httpd.apache.org/docs/current/mod/quickreference.html) +Allow from all + +# disable directory listing + + Options -Indexes + + +# enable cool URL + + RewriteEngine On + # RewriteBase / + + # prevents files starting with dot to be viewed by browser + RewriteRule /\.|^\.(?!well-known/) - [F] + + # front controller + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map)$ index.php [L] + + +# enable gzip compression + + + AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml image/svg+xml + + diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..0fa97b7 --- /dev/null +++ b/www/index.php @@ -0,0 +1,6 @@ +getByType(Nette\Application\Application::class) + ->run(); diff --git a/www/robots.txt b/www/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/www/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /