Download the PHP package cnizzardini/cakephp-preloader without Composer

On this page you can find all versions of the php package cnizzardini/cakephp-preloader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-preloader

CakePHP Preloader

Latest Version on Packagist Build Coverage Status CakePHP Minimum PHP Version

An OPCache preloader for CakePHP.

Reference: https://www.php.net/manual/en/opcache.preloading.php

This package is meant to provide an easy way for CakePHP application developers to generate preload files. Goals:

For an alternative approach, checkout DarkGhostHunter/Preloader.

For an OPCache UI, checkout amnuts/opcache-gui.

The current release is for CakePHP 5 and PHP 8.1, see previous releases for older versions of CakePHP and PHP.

Version Branch Cake Version PHP Version
1.* main ^5.0 ^8.1
0.* v0 ^4.2 ^7.4

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

Next, load the plugin:

Or via manual steps in the CakePHP plugin documentation.

Usage

The easiest way to use CakePreloader is via the console command. This command can easily be included as part of your applications build process.

You may also load configurations from a config/preloader_config.php file. Please note, command line arguments take precedence. See assets/preloader_config.php for a sample configuration file. If you prefer handling configurations another way read the CakePHP documentation on loading configuration files.

Examples:

Default loads in CakePHP core files excluding TestSuite, Console, Command, and Shell namespaces. The preload file is written to ROOT . DS . 'preload.php':

Include a list of composer packages:

Include your APP code:

Include all your projects plugins:

Include a list of your projects plugins:

Before Write Event

You can extend functionality by listening for the CakePreloader.beforeWrite event. This is dispatched just before your preloader file is written.

For more on events, read the CakePHP Events System documentation.

Preloader Class

You can customize your OPCache Preloader using the same class used by the console command. Preloader uses a port of CakePHP 4.x's Filesystem class under the hood.

Performance:

Obviously, these types of benchmarks should be taken with a bit of a gain of salt. I benchmarked this using apache bench with this project here: https://github.com/mixerapi/demo which is a dockerized REST API (LEMP stack on alpine + php-fpm 8.0). CakePHP DEBUG was set to false.

Note: opcache.preload_user=root and opcache.preload=/srv/app/preload.php were disabled for the no preload run.

Type JSON View (no db) JSON View (db select)
OPCache Only 892.69 [#/sec] (mean) 805.29 [#/sec] (mean)
OPCache Preload (default) 1149.08 [#/sec] (mean) 976.30 [#/sec] (mean)

This is 28% more requests per second for JSON responses and 21% more requests per second with JSON + simple SQL select when OPCache Preload is enabled.

Tests / Analysis

Test Suite:

Test Suite + Static Analysis:


All versions of cakephp-preloader with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
cakephp/cakephp Version ^4.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cnizzardini/cakephp-preloader contains the following files

Loading the files please wait ....