1. Go to this page and download the library: Download phly/phly-paste 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/ */
phly / phly-paste example snippets
namespace Application;
use PhlyMongo\MongoDbFactory;
use PhlyMongo\MongoCollectionFactory;
use PhlyPaste\MongoPasteService;
class Module
{
public function getServiceConfig()
{
return array('factories' => array(
'Paste\Mongo' => 'PhlyMongo\MongoConnectionFactory',
'Paste\MongoDb' => new MongoDbFactory('site', 'Paste\Mongo'),
'Paste\MongoCollection' => new MongoCollectionFactory('pastes', 'Paste\MongoDb'),
'PhlyPaste\MongoService' => function ($services) {
$collection = $services->get('Paste\MongoCollection');
return new MongoPasteService($collection);
},
));
}
}
// Create a unique index on the "hash" field
$collection->ensureIndex(array('hash' => 1), array('unique' => true));
// Create an index on "timestamp" descending
$collection->ensureIndex(array('timestamp' => -1));