Hello World
在與 vendor 目錄相同的資料夾中建立 web 目錄。使用內容在 web 目錄中建立 index.php 檔案
<?php
// web/index.php
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();
$app->get("/", function () {
    return "Hello world!";
});
$app->get("/hello/{name}", function ($name) use ($app) {
    return "Hello ".$app->escape($name);
});
$app->run();
使用 PHP 內建伺服器執行啟動應用程式
php -S localhost:8080 -t web
現在你可以開啟瀏覽器並導航到 http://localhost:8080,檢視
Hello World!
我們還定義了一條動態路線。導航到 http://localhost:8080/hello/<YOUR_NAME> 用你自己的名字替換 <YOUR_NAME>,以迎接你的第一個 Silex 應用程式。