forked from kawahara/composer-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
32 lines (22 loc) · 789 Bytes
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/helper.php';
$app = new Silex\Application();
$app['title'] = $config['title'];
$app['base_url'] = $config['base_url'];
$app['repositories'] = $config['repositories'];
$app['cache_dir'] = __DIR__ . '/' . $config['cache_dir'] ?: 'web/proxy';
$app['browser'] = $app->share(function () {
$client = new Buzz\Client\Curl();
$client->setTimeout(30);
return new Buzz\Browser($client);
});
$app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
'http_cache.cache_dir' => __DIR__ . '/cache/',
));
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__ . '/views',
));
require_once __DIR__ . '/routes.php';
return $app;