source: src/webapp/apigility/public/index.php@ 74c3571

debian/bullseye
Last change on this file since 74c3571 was 74c3571, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Added gnuboat_mapservice:

it is a REST webservice designed with Apigility to allow the user to upload data, create waters and so on

  • Property mode set to 100644
File size: 1.9 KB
Line 
1<?php
2/**
3 * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
4 * @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
5 */
6
7use Zend\Stdlib\ArrayUtils;
8use ZF\Apigility\Application;
9
10/**
11 * This makes our life easier when dealing with paths. Everything is relative
12 * to the application root now.
13 */
14chdir(dirname(__DIR__));
15
16// Redirect legacy requests to enable/disable development mode to new tool
17if (php_sapi_name() === 'cli'
18 && $argc > 2
19 && 'development' == $argv[1]
20 && in_array($argv[2], ['disable', 'enable'])
21) {
22 // Windows needs to execute the batch scripts that Composer generates,
23 // and not the Unix shell version.
24 $script = defined('PHP_WINDOWS_VERSION_BUILD') && constant('PHP_WINDOWS_VERSION_BUILD')
25 ? '.\\vendor\\bin\\zf-development-mode.bat'
26 : './vendor/bin/zf-development-mode';
27 system(sprintf('%s %s', $script, $argv[2]), $return);
28 exit($return);
29}
30
31// Decline static file requests back to the PHP built-in webserver
32if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
33 return false;
34}
35
36if (! file_exists('vendor/autoload.php')) {
37 throw new RuntimeException(
38 'Unable to load application.' . PHP_EOL
39 . '- Type `composer install` if you are developing locally.' . PHP_EOL
40 . '- Type `vagrant ssh -c \'composer install\'` if you are using Vagrant.' . PHP_EOL
41 . '- Type `docker-compose run apigility composer install` if you are using Docker.'
42 );
43}
44
45// Setup autoloading
46include 'vendor/autoload.php';
47
48$appConfig = include 'config/application.config.php';
49
50if (file_exists('config/development.config.php')) {
51 $appConfig = ArrayUtils::merge(
52 $appConfig,
53 include 'config/development.config.php'
54 );
55}
56
57// Run the application!
58Application::init($appConfig)->run();
Note: See TracBrowser for help on using the repository browser.