idg - геренартор картинок ( быстрее чем html->pdf->image )
Требования Imagick. Можно создавать такие изображения:
beginDocument(40, 30, 40, 30);
$idg->beginRow();
$idg->beginColumn(300);
$idg->image('test_image.jpg');
$idg->beginBlock()->setLeft(20);
$idg->text('Figure 1. Dolore eu fugiat nulla pariatur.')
->setFont($fontRegular)->setFontSize(14)->setTextColor('#555');
$idg->endBlock();
$idg->endColumn();
$idg->beginColumn(600);
$idg->text('Lorem ipsum dolor sit amet,
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')
->setFont($fontRegular);
$idg->endColumn();
$idg->endRow();
$idg->endDocument();
$idg->compose();
header('Content-Type: image/' . $idg->getCanvas()->getImageFormat());
print $idg->getImageBlob();
https://github.com/NikitchenkoSergey/idg
Как разместить 11 000 000 элементов в памяти PHP
$row) {
$data = pack('LLLc', $row['user'], $row['location'], $row['visited_at'], $row['mark']);
shmop_write ($shm_id , $data, $row['id']*13);
}
$i++;echo "$i\n";
}
unset($visitsData);
//$data = shmop_read($shm_id , $row['id']*13, 13);
//$data = unpack('Luser/Llocation/Lvisited_at/cmark', $data);
sleep(3600);
https://github.com/morozovsk/php-arrays-in-memory-comparison
mikeerickson/phpunit-pretty-result-printer - расширение для вывода красивого результата выполнения PHPUnit
https://github.com/mikeerickson/phpunit-pretty-result-printer
put('transaction-queue', 'transaction-11');
$message12 = $quedis->put('transaction-queue', new \Simplario\Quedis\Message('transaction-12'));
// with delay
$message22 = $quedis->put('transaction-queue', 'transaction-21', 60 * 5);
$message22 = $quedis->put('transaction-queue', 'transaction-22', (new \DateTime())->modify('+1 day'));
// with priority
$message32 = $quedis->put('transaction-queue', 'transaction-31', 0, 'high');
$message32 = $quedis->put('transaction-queue', 'transaction-32', 0, 'low');
// Get Quedis statistic
// =========================================
// for concrete queue
$queueStat = $quedis->stats('transaction-queue');
// for all queues
$statsAll = $quedis->stats();
// Stop/start queue
// =========================================
// stop queue
$quedis->stop('transaction-queue');
// for all queues
$quedis->start('transaction-queue');
// check
$isStop = $quedis->isStop('transaction-queue');
print_r($isStop);
/**
*
* Take message from Quedis
*
* Message flows (like in the Beanstalk: http://beanstalkc.readthedocs.io/en/latest/tutorial.html )
* ------------------------------------------------------------------------------------------------
*
* 1) put pop
* -----> [READY] --------> *poof*
*
*
* 2) put reserve delete
* -----> [READY] ---------> [RESERVED] --------> *poof*
*
*
* 3) put with delay release with delay
* ----------------> [DELAYED] <------------.
* | |
* | (time passes) |
* | |
* put v reserve | delete
* -----------------> [READY] ---------> [RESERVED] --------> *poof*
* ^ ^ | |
* | \ release | |
* | ``-------------' |
* | |
* | kick |
* | |
* | bury |
* [BURIED] <---------------'
* |
* | delete
* ``--------> *poof*
*
*/
// just pop single message
$message = $quedis->pop('transaction-queue');
print_r($message);
// just pop single message with timeout (redis blpop timeout)
$message = $quedis->pop('transaction-queue', 10);
print_r($message);
// reserve flow
$message = $quedis->reserve('transaction-queue', 10);
$quedis->delete($message);
// reserve > bury > kick > reserve > delete
$message = $quedis->reserve('transaction-queue', 10);
// something goes wrong ...
$quedis->bury($message);
// ok lets retry one more time ...
$quedis->kick($message);
$messageSame = $quedis->reserve($message);
// all is ok!
$quedis->delete($messageSame);
// Iterator usage
// =========================================
// iterate reserve all messages
$iterator = $quedis->iterator('transaction-queue', 'reserve', 10);
foreach($iterator as $index => $message){
print_r($message);
$quedis->delete($message);
}
// or like standalone with pop logic
$queue = new \Simplario\Quedis\Queue(new \Predis\Client(), 'super-puper-quedis');
$iterator = new \Simplario\Quedis\Iterator($queue, 'transaction-queue', 'pop', 10);
foreach($iterator as $index => $message){
print_r($message);
}
https://github.com/simplario/quedis
https://github.com/renatomarinho/laravel-page-speed
php-spx - профайлер на php
https://github.com/NoiseByNorthwest/php-spx