Download the PHP package fidry/cpu-core-counter without Composer

On this page you can find all versions of the php package fidry/cpu-core-counter. 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 cpu-core-counter

CPU Core Counter

This package is a tiny utility to get the number of CPU cores.

Usage

Advanced usage

Changing the finders

When creating CpuCoreCounter, you can change the order of the finders or disable specific ones by passing the list of finders to use:

Choosing only logical or physical finders

FinderRegistry provides two helpful entries:

By default, CpuCoreCounter uses the logical finders, since this is usually what you need and is also what the PHP source uses when building the PHP binary.

Virtual machines

Inside a virtual machine (VM), such as a VMware or Parallels Desktop VM, a micro-VM, a CI runner or a cloud instance, the library sees only the VM's CPUs, not the host's. As a result:

Containers

A container, such as Docker or LXC, shares the host's kernel, so the library sees the host's CPUs. As a result:

Ignoring the system load

By default, getAvailableForParallelisation() ignores the system load. You can use it only to get the number of CPU cores and the CPU limit, e.g. the cgroup CPU quota:

sys_getloadavg() is not available on Windows, and it can be disabled with disable_functions. If you pass a $loadLimit and set $systemLoadAverage to null there, the load average is treated as 0: $loadLimit still applies, but the current load does not reduce the result.

Inspecting what the finders find on your system

Three scripts provide insight into what the finders find:

Debugging the results

Three approaches help understand how a result was obtained:

  1. If you use the default finder registries, the scripts described in the previous section provide detailed information.
  2. To understand how the number of CPU cores was found, use CpuCoreCounter::trace().
  3. To understand how the number of CPU cores available for parallelisation was calculated, inspect the ParallelisationResult returned by CpuCoreCounter::getAvailableForParallelisation().

Backward Compatibility Promise (BCP)

The policy largely follows Symfony's. Code marked as @private or @internal is excluded from the BCP.

The following elements are also excluded:

Contributing

See CONTRIBUTING.md for how to set up the project, run the tests, and understand the end-to-end tests and inspection builds.

License

This package is licensed using the MIT License.

See LICENSE.md for details.


All versions of cpu-core-counter with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
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 fidry/cpu-core-counter contains the following files

Loading the files please wait ...