Download the PHP
package jasny/immutable without Composer
On this page you can find all versions of the php package
jasny/immutable. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor jasny Package immutable Short Description Helper methods for immutable objects License
MIT
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.
The library provides a helper methods for immutable objects.
Installation
composer require jasny/immutable
Usage
NoDynamicProperties
The Jasny\Immutable\NoDynamicProperties defines the __set method, which will throw a LogicException when
attempting to set a non-existing property.
With
Immutable objects may have with... methods, that create an altered version of the object, while the immutable object
itself remains unchanged. An example are classes work as described in PSR-7.
The with... methods in these objects typically follow the same method.
The Jasny\Immutable\With trait implements a protected withProperty() and withoutProperty() method for setting and
unsetting properties on a clone of the object.
The trait contains the withPropertyKey() and withoutPropertyKey() methods for setting and unsetting an item of an
associative array.
The withPropertyItem() and withoutPropertyItem() methods work on a sequential array to add and remove an item.
If the third argument of withPropertyItem() is set to true, the item isn't added if it's already in the array.
If the item is in the array multiple times, withoutPropertyItem() will remove them all. Strict comparison is used to
find items.
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 jasny/immutable contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.