Download the PHP package ali-eltaweel/lazy-props without Composer

On this page you can find all versions of the php package ali-eltaweel/lazy-props. 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 lazy-props

Lazy-Properties


Installation

Install lazy-props via Composer:

Usage

Declaring Lazy Properties

Upon instantiation of the Database class, the connection property will be unset, so that calls to $db->connection are directed to the __get magic method provided by the LazyProperties trait. This method will then call the createConnection method on the first call to $db->connection, and set the connection property to the return value of that method. Subsequent calls to $db->connection will return the already initialized value.

Common Initializer Method

If your class declares more than one lazy property, you can use a common initializer method for all of them:

You can also you the InitializerMethod annotation on your class to save yourself some typing:


Subclasses's Readonly, Lazy-initialized Properties

Take a look at the following example:

It looks fine, and it is...

But, when you change the y property to be readonly:

... you will get an error by just instantiating the Y class:

To fix this; each class has to unset (uninitialize) its own lazy properties, to do so, use the LazyPropertiesExtension trait in subclasses (of all generations) and annotate them with the ExtendedLazyProperties annotation giving the names of the extended lazy properties:


All versions of lazy-props with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ali-eltaweel/attr-action Version ^1.0.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 ali-eltaweel/lazy-props contains the following files

Loading the files please wait ....