2017 © Pedro Peláez
 

library communism

Little utility to easily extract and inject properties from objects

image

carlosv2/communism

Little utility to easily extract and inject properties from objects

  • Monday, February 13, 2017
  • by carlosV2
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,516 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 46 % Grown

The README.md

Communism

Little utility to easily extract and inject properties from objects., (*1)

License Build Status SensioLabsInsight, (*2)

Usage

If you want to extract any object property, use one of the following constructions:, (*3)

$value = From($object)->property;
// or
$value = From($object)->extract('property');

If you want to inject any object property, use one of the following constructions:, (*4)

To($object)->property = $value;
// or
To($object)->inject('property', $value);

If you want to replace any object property, use one of the following constructions:, (*5)

// The `replace` method is avilable for both `From` and `To`
From($object)->property(function ($value) {
    // `$value` will contain the current value for that property

    // Whatever is returned will be the new value of the property
    return $newValue;
});
// or
From($object)->replace('property', function ($value) {
    // `$value` will contain the current value for that property

    // Whatever is returned will be the new value of the property
    return $newValue;
});

Both functions From and To instantiate a carlosV2\Communism\Communist object which allows the extraction and injection of properties., (*6)

Words of wisdom

This project is designed to be used for development environment only. If you find yourself using this project on production code, you should better reconsider your architecture., (*7)

Install

Open a command console, enter your project directory and execute the following command to download the latest stable version of this project:, (*8)

$ composer require --dev carlosv2/communism

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*9)

The Versions

13/02 2017

dev-master

9999999-dev

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.3 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

13/02 2017

1.2.3

1.2.3.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.3 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

10/02 2017

1.2.2

1.2.2.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.3 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

10/02 2017

1.2.1

1.2.1.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.3 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

28/01 2017

1.2.0

1.2.0.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.4 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

12/12 2016

1.1.0

1.1.0.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.4 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property

12/12 2016

1.0.0

1.0.0.0

Little utility to easily extract and inject properties from objects

  Sources   Download

MIT

The Requires

  • php ~5.4 || ~7.0

 

The Development Requires

by Carlos Ortega

test reflection property