string - библиотека для манипуляции с multibyte strings
use Opis\String\UnicodeString as wstring;
$str = wstring::from('??????????');
echo $str->substring(3, 4)
->toUpper(); //> ????
https://github.com/opis/string
use Opis\String\UnicodeString as wstring;
$str = wstring::from('??????????');
echo $str->substring(3, 4)
->toUpper(); //> ????
use Goutte\Client;
$client = new Client();
// переходим на сайт
$crawler = $client->request('GET', 'http://www.symfony.com/blog/');
// нажать на ссылку
$link = $crawler->selectLink('Security Advisories')->link();
$crawler = $client->click($link);
// получить данные
$crawler->filter('h2 > a')->each(function ($node) {
print $node->text()."\n";
});
require_once 'vendor/autoload.php';
use ColorThief\ColorThief;
$dominantColor = ColorThief::getColor($sourceImage);
use Grafika\Grafika;
$editor = Grafika::createEditor();
$editor->open( "path/to/jpeg/image.jpg" );
$editor->resizeExact( 200, 200 );
$editor->save( "path/to/edited.jpg", null, 90 );
$websocket = new Hoa\Websocket\Server(
new Hoa\Socket\Server('ws://127.0.0.1:8889')
);
$websocket->on('open', function (Hoa\Event\Bucket $bucket) {
echo 'new connection', "\n";
return;
});
$websocket->on('message', function (Hoa\Event\Bucket $bucket) {
$data = $bucket->getData();
echo '> message ', $data['message'], "\n";
$bucket->getSource()->send($data['message']);
echo '< echo', "\n";
return;
});
$websocket->on('close', function (Hoa\Event\Bucket $bucket) {
echo 'connection closed', "\n";
return;
});
$websocket->run();
use Omnimail\Email;
use Omnimail\AmazonSES;
$sender = new AmazonSES($accessKey, $secretKey);
$email = (new Email())
->addTo('[email protected]')
->setFrom('[email protected]')
->setSubject('Hello, world!')
->setTextBody('Hello World! How are you?');
$sender->send($email);
<?php
// Include Composer autoloader if not already done.
include 'vendor/autoload.php';
// Parse pdf file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('document.pdf');
$text = $pdf->getText();
echo $text;
$loop = React\EventLoop\Factory::create();
$factory = new Factory($loop);
$factory->createClient('localhost:6379')->then(function (Client $client) use ($loop) {
$client->set('greeting', 'Hello world');
$client->append('greeting', '!');
$client->get('greeting')->then(function ($greeting) {
// Hello world!
echo $greeting . PHP_EOL;
});
$client->incr('invocation')->then(function ($n) {
echo 'This is invocation #' . $n . PHP_EOL;
});
// end connection once all pending requests have been resolved
$client->end();
});
$loop->run();
Категории:
Оставить на заметку в: