Download the PHP package laracraft-tech/memoize without Composer

On this page you can find all versions of the php package laracraft-tech/memoize. 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 memoize

Memoize

Latest Version on Packagist Tests Check & fix styling License

Introduction

This package provides you with a simple PHP trait, which adds high-performance memoization to your classes!

Installation

Usage

The memoize method accepts a callable.

No matter how many times you run $myClass->getNumber() you'll always get the same number.

The memoize method will only run once per combination of use variables the closure receives.

So calling $myClass->getNumberForLetter('A') will always return the same result, but calling $myClass->getNumberForLetter('B') will return something else.

Some memoization packages uses the arguments of the containing method for the once per combination idea. We think this feels a bit unintuitive and in certain circumstances will affect performance. So we use the use variables of the closure as the once per combination key. As a fallback, if you like/need to, we also let you fully self define your once per combination key in a second optional parameter of the closure.

So when calling $myClass->processSomethingHeavy1(SomeModel::find(1)) the variable $relation will always have the same value like in $myClass->processSomethingHeavy1(SomeModel::find(2)) as long as they have the same foo_relation_id. In some other memoization packges you would lose performance here, cause the containing method parameter ($someModel) has changed... Note that processSomethingHeavy3 would also lose performance, even though the foo_relation_id would be the same, cause here also the changed $someModel would be used as the combination key and that model would have at least a different id.

Enable/Disable

You can globally enable or disable the memoize cache by setting MEMOIZATION_GLOBALLY_DISABLED to true in your .env file.

If you only want to disable to memoize cache for a specifiy class, do something like this:

Change log

Please see the changelog for more information on what has changed recently.

Testing

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.


All versions of memoize with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/once Version ^3.1
symfony/var-dumper Version ^6.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 laracraft-tech/memoize contains the following files

Loading the files please wait ....