2017 © Pedro Peláez
 

joomla-package compat

Joomla Compat Package

image

joomla/compat

Joomla Compat Package

  • Sunday, April 8, 2018
  • by mbabker
  • Repository
  • 9 Watchers
  • 0 Stars
  • 70,342 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 9 Versions
  • 3 % Grown

The README.md

The Compat Package Build Status

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This is a simple package that contains forward compatibility classes and interfaces that are registered to the global namespace, (*2)

Deprecated

The joomla/compat package has been deprecated. No further updates are planned., (*3)

JsonSerializable

JsonSerializable is a PHP 5.4 interface that allows you to specify what data to serialize to JSON when you json_encode an object that implements the interface., (*4)

Usage

Since this is a PHP 5.4 interface, the jsonSerialize() method does not get called automatically when json_encode-ing an instance of the class when used in 5.3. To work around this, simply call the jsonSerialize() method directly when passing it to json_encode. This is forward-compatible with PHP 5.4., (*5)

Note in some instances of PHP 5.5 from Debian the interface is also missing (see http://stackoverflow.com/questions/18239405/php-fatal-error-call-to-undefined-function-json-decode) which will also require this interface to be included., (*6)

class MyClass implements \JsonSerializable
{
    /**
     * @var  array  Holds the data this class uses.
     */
    protected $data;

    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function jsonSerialize()
    {
        return $this->data;
    }
}

$obj = new MyClass(array('sample', 'data', 'to', 'encode'));

$encoded = json_encode($obj->jsonSerialize());

Installation via Composer

Add "joomla/compat": "~1.0" to the require block in your composer.json and then run composer install., (*7)

{
    "require": {
        "joomla/compat": "~1.0"
    }
}

Alternatively, you can simply run the following from the command line:, (*8)

composer require joomla/compat "~1.0"

The Versions

08/04 2018

dev-master

9999999-dev https://github.com/joomla-framework/compat

Joomla Compat Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

framework joomla compat

24/02 2015

1.2.0

1.2.0.0 https://github.com/joomla-framework/compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

09/02 2014

1.1.1

1.1.1.0 https://github.com/joomla-framework/compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.0

1.0.0.0 https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.0-alpha

1.0.0.0-alpha https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.0-beta

1.0.0.0-beta https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.0-beta2

1.0.0.0-beta2 https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.0-beta3

1.0.0.0-beta3 https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat

15/05 2013

1.1.0

1.1.0.0 https://github.com/joomla/joomla-framework-compat

Joomla Compat Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework joomla compat