jakoch/phantomjs-installer
Composer package that downloads and installs the PhantomJS binary for Linux, macOS, and Windows into your project’s bin directory. Supports version pinning, platform overrides, custom mirrors, and retrying downloads with version fallback.
/bin directory installation unchanged, mitigating system-wide conflicts. New Risk: Exception-throwing behavior (3.0.3) may break silent failures, forcing explicit error handling.spatie/pdf-to-text, but PhantomJS’s EOL status (2018) and lack of maintainer updates (e.g., no patches for CVEs) make this a high-risk dependency. Alternatives (Puppeteer/Playwright) are strongly recommended.composer require jakoch/phantomjs-installer. However, 3.0.3’s exception-throwing requires updates to error-handling logic (e.g., try-catch blocks around installation).composer install).base_path('/bin/phantomjs')), but 3.0.3’s stricter validation may surface path issues in CI/CD pipelines.try-catch around installation in composer.json:
"scripts": {
"post-install-cmd": [
"@php -r \"try { require __DIR__.'/vendor/autoload.php'; $installer = new \\Jakoch\\PhantomJs\\Installer; $installer->install(); } catch (\\Exception $e) { echo 'PhantomJS install failed: '.$e->getMessage().'\\n'; exit(1); }\""
]
}
puppeteer/puppeteer or playwright/php) with a parallel feature-compatibility matrix.spatie/laravel-playwright)?exec() calls in try-catch blocks.if (!file_exists($phantomJsPath)) {
throw new \RuntimeException('PhantomJS not installed. Run `composer install`.');
}
composer require jakoch/phantomjs-installer:^3.0
"scripts": {
"post-install-cmd": [
"@php -r \"try { require __DIR__.'/vendor/autoload.php'; $installer = new \\Jakoch\\PhantomJs\\Installer; $installer->install(); } catch (\\Exception $e) { echo 'PhantomJS install failed: '.$e->getMessage().'\\n'; exit(1); }\""
]
}
class PhantomJsService {
public function __construct(private string $path) {
if (!file_exists($path)) {
throw new \RuntimeException('PhantomJS deprecated; use Puppeteer instead.');
}
}
// ...
}
exec('phantomjs script.js') with:
use Puppeteer\Puppeteer;
$browser = await Puppeteer::launch();
$page = await $browser->newPage();
await $page->pdf(['path' => 'output.pdf']);
deprecated() helper).C:\ vs. /bin).AppServiceProvider.puppeteer/puppeteer (Node.js) + php-bridge (e.g., spatie/php-bridge).playwright/php (native PHP port).laravel-headless-chrome (wrapper for Puppeteer).README with:
DEPRECATION.md with timeline and alternatives.PhantomJS installer failed: Download not found → Check proxy/CI environment.post-install-cmd with error handling (as above).| Issue | Owner | SLA |
|---|---|---|
| 3.0.3 installation failures | DevOps | 1h |
| PhantomJS crashes | TPM | 24h |
| Migration to Puppeteer | Backend Team |
How can I help you explore Laravel packages today?