lang/php

PHP Slim Framework helloWorld

C/H 2018. 6. 7. 18:07

Slim은 간단하면서도 강력한 웹 응용 프로그램과 API를 신속하게 작성하는 데 도움이되는 PHP 마이크로 프레임 워크입니다.

Download & Install

#php composer.phar create-project slim/slim-skeleton [my-app-name]
composer create-project slim/slim-skeleton slim
cd slim
cat public/index.php
php -S localhost:8080 -t public public/index.php
<?php
if (PHP_SAPI == 'cli-server') {
    // To help the built-in PHP dev server, check if the request was actually for
    // something which should probably be served as a static file
    $url  = parse_url($_SERVER['REQUEST_URI']);
    $file = __DIR__ . $url['path'];
    if (is_file($file)) {
        return false;
    }
}

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

session_start();

// Instantiate the app
$settings = require __DIR__ . '/../src/settings.php';
$app = new \Slim\App($settings);

// Set up dependencies
require __DIR__ . '/../src/dependencies.php';

// Register middleware
require __DIR__ . '/../src/middleware.php';

// Register routes
require __DIR__ . '/../src/routes.php';

// Run app
$app->run();


반응형