Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 16, 2024 via composer

classpreloader/classpreloader 4.2.0

Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case
Package summary
Share
0
issues
2
licenses
1
MIT
1
BSD-3-Clause
Package created
28 Feb 2013
Version published
28 Aug 2021
Maintainers
2
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
classpreloader/classpreloader@4.2.0

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
nikic/php-parser@v4.19.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of classpreloader/classpreloader 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
nikic/php-parserv4.19.1-BSD-3-Clause
prod

Visualizations

Frequently Asked Questions

What does classpreloader/classpreloader do?

Classpreloader/classpreloader is a highly useful tool that optimizes PHP application performance. It does this by generating a single PHP file that houses all of the autoloaded files needed for a specific use case, thereby minimizing the repeated cost of autoloading necessary classes over and over again. However, it's critical to understand that this tool should be employed only for specific use cases and a balance must be maintained between preloading and autoloading. The potential benefits can be best determined through application-specific benchmarks.

How do you use classpreloader/classpreloader?

Classpreloader/classpreloader can be integrated into your PHP application with a few straightforward steps. Initially, you must define ClassPreloader as a dependency in your composer.json file by incorporating "classpreloader/classpreloader": "^4.1" into your require block. If you intend to use the CLI tool, ensure to also add "classpreloader/console": "^3.1" to the require block.

Once the installation is done, use the command ./vendor/bin/classpreloader compile along with several command-line flags to generate a preloader. Each flag serves a unique purpose, for example, --config is used to list files to combine into a classmap, --output defines the path for the compiled PHP file, --skip_dir_file skips files with __DIR__ or __FILE__ for portability, and other flags aim at dealing with constants and strict types among other things.

It's also possible to incorporate an automated process with Composer that generates preloaders each time the project's autoloader is regenerated or updated.

Here's a PHP code usage example:

require __DIR__.'/src/ClassLoader.php';
use ClassPreloader\ClassLoader;
$config = ClassLoader::getIncludes(function (ClassLoader $loader) {
    require __DIR__.'/vendor/autoload.php';
    $loader->register();
});
return $config;

And a Composer automation example:

{
    "require": {
        "classpreloader/console": "^3.1"
    },
    "scripts": {
        "post-autoload-dump": "@php vendor/bin/classpreloader compile --config=/path/to/the_example.php --output=/path/to/preload.php"
    },
    "config": {
        "bin-dir": "bin"
    }
}

Where are the classpreloader/classpreloader docs?

For detailed information about classpreloader/classpreloader, you can visit the official documentation at its GitHub repository: https://github.com/ClassPreloader/ClassPreloader. The repository contains comprehensive explanations about the package, its installation, usage examples along with information about the commands and functionalities it provides.