2017 © Pedro Peláez
 

library datatype

PHP simple library for managing of data types.

image

josantonius/datatype

PHP simple library for managing of data types.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

PHP DataType library

Latest Stable Version License, (*1)

This library will no longer be supported. Alternatively, you can use the Validate library., (*2)

Versión en español, (*3)

PHP simple library for managing of data types., (*4)



Requirements

This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher., (*5)

Installation

The preferred way to install this extension is through Composer., (*6)

To install PHP DataType library, simply:, (*7)

composer require Josantonius/DataType

The previous command will only install the necessary files, if you prefer to download the entire source code you can use:, (*8)

composer require Josantonius/DataType --prefer-source

You can also clone the complete repository with Git:, (*9)

$ git clone https://github.com/Josantonius/PHP-DataType.git, (*10)

Or install it manually:, (*11)

Download DataType.php:, (*12)

wget https://raw.githubusercontent.com/Josantonius/PHP-DataType/master/src/DataType.php

Available Methods

Available methods in this library:, (*13)

- Convert object to array

DataType::objectToArray($object);
Attribute Description Type Required Default
$object Variable of the object. object Yes

# Return (array) → object converted to array, (*14)

Quick Start

To use this library with Composer:, (*15)

require __DIR__ . '/vendor/autoload.php';

use Josantonius\DataType\DataType;

Or If you installed it manually, use it:, (*16)

require_once __DIR__ . '/DataType.php';

use Josantonius\DataType\DataType;

Usage

Example of use for this library:, (*17)

$object = new \stdClass();

$object->name  = 'Josantonius';
$object->email = 'info@josantonius.com';
$object->url   = 'https://github.com/josantonius/PHP-DataType';

echo '

'; var_dump(DataType::objectToArray($object)); echo '
'; /* array(3) { ["name"]=> string(11) "Josantonius" ["email"]=> string(20) "info@josantonius.com" ["url"]=> string(36) "https://github.com/josantonius/PHP-DataType" } */

Tests

To run tests you just need composer and to execute the following:, (*18)

git clone https://github.com/Josantonius/PHP-DataType.git

cd PHP-DataType

composer install

Run unit tests with PHPUnit:, (*19)

composer phpunit

Run PSR2 code standard tests with PHPCS:, (*20)

composer phpcs

Run PHP Mess Detector tests to detect inconsistencies in code style:, (*21)

composer phpmd

Run all previous tests:, (*22)

composer tests

If this project helps you to reduce your development time, you can sponsor me to support my open source work :blush:, (*23)

License

This repository is licensed under the MIT License., (*24)

Copyright © 2016-2018, Josantonius, (*25)

The Versions

06/01 2018

dev-master

9999999-dev

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

php array hhvm object to array array to object

06/01 2018

1.1.6

1.1.6.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

php array hhvm object to array array to object

12/11 2017

1.1.5

1.1.5.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

php array hhvm object to array array to object

30/10 2017

1.1.4

1.1.4.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

php array hhvm object to array array to object

17/09 2017

1.1.3

1.1.3.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

php array hhvm object to array array to object

18/07 2017

1.1.2

1.1.2.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

php array hhvm object to array array to object

18/03 2017

1.1.1

1.1.1.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

php array hhvm object to array array to object

30/01 2017

1.1.0

1.1.0.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

php array hhvm object to array array to object

14/12 2016

1.0.0

1.0.0.0

PHP simple library for managing of data types.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

php array hhvm object to array array to object