1. Go to this page and download the library: Download aptoma/silex-extras library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aptoma / silex-extras example snippets
$ftp = new Ftp($hostname, $username, $password, $logger);
$file = new File($pathToFile);
$destination = 'path/on/server/with/filename.txt';
// All directories needs to be created before upload
$ftp->preparePaths(array($destination));
$ftp->put($destination, $file->getRealPath());
use Monolog\Logger;
use Aptoma\Log\RequestProcessor;
$app = new \Silex\Application(...);
$app['logger']->pushProcessor(new RequestProcessor($app));
$app['logger']->pushProcessor(new ExtraContextProcessor(array('service' => 'my-service', 'environment' => 'staging')));
$app['meta.service'] = 'drvideo-metadata-admin-gui'; // The name of the service, consult with AMP
$app['meta.customer'] = 'Aptoma'; // The name of customer for this record
$app['meta.environment'] = 'production'; // The environment of the current installation
use Symfony\Component\Console\Application;
$app = ', '1.0');
// You should only register this service provider when running commands
$app->register(new \Aptoma\Silex\Provider\ConsoleLoggerServiceProvider());
$console->addCommands(
array(
//...
)
);
$console->run($app['console.input'], $app['console.output']);
$jsonErrorHandler = new Aptoma\JsonErrorHandler($app);
$app->error(array($jsonErrorHandler, 'handle'));
class MyObjectTest extends TestToolkit\BaseWebTestCase
{
public function setUp()
{
$this->pathToAppBootstrap = __DIR__.'/../../app/app.php';
parent::setUp();
}
}
$app->register(
new Aptoma\Silex\Provider\ApiKeyServiceProvider(),
array(
'api_key.user_provider' => new App\Specific\UserProvider(),
'api_key.encoder' => new App\Specific\Encoder()
)
);
$this->app['guzzle.plugins'] = $this->app->share(
$this->app->extend(
'guzzle.plugins',
function (array $plugins, $app) {
$plugins[] = new HttpCallInterceptorPlugin($app['logger']);
return $plugins;
}
)
);
// Intercept errors and fail tests, if you don't do this, you'll most often get
// a rather cryptic error message
$this->app->error(
function (HttpCallToBackendException $e) use ($testCase) {
$testCase->fail($e->getMessage());
},
10
);
$this->app->error(
function (BatchTransferException $e) use ($testCase) {
$testCase->fail($e->getMessage());
},
10
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.