Download the PHP package nayjest/manipulator without Composer

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

Manipulator (mp)

Small library for manipulating PHP objects.

Build Status Code Coverage Latest Stable Version

SensioLabsInsight

It's like symfony/property-access with more features, faster (no reflection usage) and without over-engineering (~300 lines of code, few functions).

Requirements

Installation

The recommended way of installing the component is through Composer.

Run following command:

Usage

Function mp\instantiate

Creates class instance using specified constructor arguments.

Arguments
Returned Value

Function returns instantiated object

Example

Function mp\setPublicProperties

Assigns values from array to existing public properties of target object.

By default this function ignores fields having no corresponding properties in target object, but this behavior can be changed if TRUE will be passed to third argument.

Arguments
Returned Value

Function returns array containing names of successfully assigned properties.

Function mp\setValuesUsingSetters

Assigns values from array to corresponding properties of target object using setters.

This function works similar to mp\setPublicProperties(), but uses setter methods instead of public properties.

Field names may be in snake or camel case, it will be converted to camel case and prefixed by 'set' to check availability of corresponding setter in target object.

Fields having no corresponding setters in target object will be ignored.

This function does not work with magic setters created using __set() php method.

Arguments
Returned Value

Function returns array containing names of successfully assigned properties.

Example

Function mp\setValues

Assigns values from $fields array to $target. Target may be object or array.

By default mp\setValues ignores fields having no corresponding properties or setters in target object but this behavior can be changed if MP_CREATE_PROPERTIES option is used.

Assigning values using setters can be disabled by removing MP_USE_SETTERS option (it's enabled by default).

When target is an array, mp\setValues will call array_merge PHP function.

Arguments
Returned Value

Function returns array containing names of successfully assigned properties.

Example

Results:

# Options Assigned properties
1 not specified (MP_USE_SETTERS by default) property1, property2
2 MP_USE_SETTERS | MP_CREATE_PROPERTIES property1, property2, property3 (created)
3 MP_CREATE_PROPERTIES \ property2, property3 (created)
4 0 property2

Function mp\getWritable

Returns names of writable properties for objects and classes or existing keys for arrays.

Only public object properties and properties having setters considered writable.

For setters, this function will return property names based on setter names (setter names are converted to snake case, 'set' prefixes are removed).

Detecting properties by setters can be disabled by specifying second argument as FALSE.

Arguments
Returned Value

Array containing names of writable properties.

Function mp\getMethodsPrefixedBy

Returns method names from target object/class that starts from specified keyword and followed by uppercase character.

Arguments
Returned Value

Array containing method names.

Example

Function mp\getSetters

Returns method names from target object/class that looks like setters.

Arguments
Returned Value

Array containing method names.

Function mp\getGetters

Returns method names from target object/class that looks like setters.

Arguments
Returned Value

Array containing method names.

Function mp\getValues

Returns values of object properties or array elements specified in $propertyNames argument.

This function supports getters, i. e. value returned by getSomeValue() method of target object can be requested as 'some_value' property.

Arguments
Returned Value

Array containing required values.

Function mp\getValue

Extracts value specified by property / field / method name from object or array. This function supports property paths (prop1.prop2.prop3) and getters.

Arguments

Function mp\getValueByRef

Extracts value specified by property / field / method name from object or array by reference if possible. This function acts like mp\getValue with only difference that value will be returned by reference if possible.

Function mp\setValue

Assigns value, supports property paths (prop1.prop2.prop3).

Arguments
Returned Value

This function returns TRUE if value was successfully assigned, FALSE otherwise

Testing

This package bundled with PhpUnit tests.

Command for running tests:

Contributing

Please see Code of Conduct for details.

License

© 2014 — 2016 Vitalii Stepanenko

Licensed under the MIT License.

Please see License File for more information.


All versions of manipulator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
nayjest/str-case-converter Version ^1
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 nayjest/manipulator contains the following files

Loading the files please wait ....