Download the PHP
package dandjo/object-adapter without Composer
On this page you can find all versions of the php package
dandjo/object-adapter. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor dandjo Package object-adapter Short Description Provides adapters for target objects with easy property access via magic getter and setter. License
MIT
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.
Provides some base classes for adapting target objects with annotated property access.
Installation
composer require dandjo/object-adapter
Purpose
Its purpose is to make life easier when working with complex objects behind template engines like Twig. It offers some
syntax sugar like writing methods with annotations and accessing the return value via the annotated property name on
the adapter. The same applies to setters. It also offers a generic get method for nested data structures using a dotted
notation. For this to work, each link in the chain must be an instance of ObjectAdapter or an accessible property.
Usage
To provide a property for your adapter, you have to annotate an appropriate method with either
@property\getter property_name or @property\setter property_name. A setter method must take a parameter with the
value the property should be set to. The name of the method can be chosen arbitrarily. However, the annotation is
important. If there is no getter or setter, the adapter acts transparently on its target object.
Examples
Imagine you have an object with some properties, our target object. When using the ObjectAdapter base class directly,
all properties are transparent by default.
We inherit from the ObjectAdapter and create a getter for the foo property on our target object. With the annotation,
the adapter offers a property called myFoo.
Here's an example with a setter.
If you want to use deep object hierarchies, have a look at the following example. Chained calls are safe since every
non-existent property will return a NullAdapter.
Each adapter implements the ArrayAccess and Interator Interface, so you can also access or loop annotated properties
like follows.
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 dandjo/object-adapter 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.