1. Go to this page and download the library: Download darkghosthunter/preloader 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/ */
darkghosthunter / preloader example snippets
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->writeTo(__DIR__.'/preloader.php');
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->when(fn () => $app->cache()->get('should_run'));
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->whenOneIn(50);
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->append([
__DIR__ . '/files/*/more_files',
__DIR__ . '/classes/'
]);
use Symfony\Component\Finder\Finder;
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->append(function (Finder $find) {
$find->files()->in('/package')->name(['*.php', '*.twig']);
});
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->exclude([
__DIR__ . '/files/*/more_files',
__DIR__ . '/vendor'
]);
use Symfony\Component\Finder\Finder;
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->exclude(function (Finder $find) {
$find->files()->in('/package')->name(['*.php', '*.twig']);
});
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->selfExclude();
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->memoryLimit(32);
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->useRequire(__DIR__ . '/../vendor/autoload.php');
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->ignoreNotFound();
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->writeTo(__DIR__ . '/preloader.php');
use DarkGhostHunter\Preloader\Preloader;
Preloader::make()->getList();
// /www/app/safe_preloader.php
register_shutdown_function(function (): void {
$error = error_get_last();
if (!$error) {
return;
}
echo 'Preloader Script has stopped with an error:' . \PHP_EOL;
echo 'Message: ' . $error['message'] . \PHP_EOL;
echo 'File: ' . $error['file'] . \PHP_EOL;
});
//
// index.php
use Framework\App;
use DarkGhostHunter\Preloader\Preloader;
loader::make()
->whenOneIn(100)
->memoryLimit(64)
->writeTo(PHP_LOCALSTATEDIR . '/preload.php'); // put it in /var.;
ini
opcache.preload=/www/app/preload.php
ini
opcache.preload=/www/app/safe_preloader.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.