Skip to content

Releases: josantonius/php-json

v2.0.8

11 Jan 05:28
Compare
Choose a tag to compare

What's Changed

PHP 8.0 is no longer supported.

Added

  • Josantonius\Json\Json->pop() method.

  • Josantonius\Json\Json->shift() method.

  • Josantonius\Json\Json->unshift() method.

  • Josantonius\Json\Json->unset() method.

  • Josantonius\Json\Tests\PopMethodTest class.

  • Josantonius\Json\Tests\ShiftMethodTest class.

  • Josantonius\Json\Tests\UnsetMethodTest class.

  • Josantonius\Json\Tests\UnshiftMethodTest class.

  • Josantonius\Json\Exceptions\NoIterableElementException class.

  • Josantonius\Json\Exceptions\NoIterableFileException class.

  • .markdownlint.json file.

Removed

  • The filepath method. Use the filepath property instead.

  • The option to handle remote files via their URL.

  • Spanish documentation.

  • Josantonius\Json\Tests\FilepathMethodTest class.

  • Josantonius\Json\Exceptions\UnavailableMethodException class.

Refactored

  • The get method now supports the $associative parameter.
  • The get method now returns a mixed value.
  • The set method now supports the $dot parameter to indicate the array level using dot notation.
  • The set method now returns the resulting content of the JSON file after performing the action.
  • The merge method now supports the $dot parameter to indicate the array level using dot notation.
  • The push method now supports the $dot parameter to indicate the array level using dot notation.

Full Changelog: v2.0.7...v2.0.8

v2.0.7

29 Sep 17:30
f67bec9
Compare
Choose a tag to compare

What's Changed

  • Release/v2.0.7 by @josantonius in #23

  • Tests for Windows have been added.

  • Tests for PHP 8.2 have been added.

Full Changelog: v2.0.6...v2.0.7

v2.0.6

05 Sep 22:30
Compare
Choose a tag to compare

What's Changed

  • pre-release/v2.0.6 in #21
  • Release/v2.0.6 in #22

Added

  • Josantonius\Json\Json->filepath() method.
  • Josantonius\Json\Json->exists() method.

Changed

  • The file is no longer created if it does not exist when the instance is created.
  • The $content parameter of the set method is now optional and contains an empty array by default.

Deleted

  • Josantonius\Json\Exceptions\CreateDirectoryException class.
  • Josantonius\Json\Tests\ExistsMethodTest class.
  • Josantonius\Json\Tests\GetFilepathMethodTest class.
  • Josantonius\Json\Json->createFileIfNotExists() method.

Refactor

  • The notation type in the test function names has been changed from camel to snake case for readability.
  • Functions were added to document the methods and avoid confusion.
  • Disabled the ´CamelCaseMethodName´ rule in ´phpmd.xml´ to avoid warnings about function names in tests.
  • The alignment of the asterisks in the comments has been fixed.

Updated

  • Tests.

Full Changelog: v2.0.5...v2.0.6

v2.0.5

11 Aug 14:42
Compare
Choose a tag to compare

What's Changed

  • release/v2.0.5 in #20

  • The exceptions directory was renamed from exception to exceptions.

  • Improved documentation.

  • Improved doc comments in Josantonius\Json\Json.

Full Changelog: v2.0.4...v2.0.5

v2.0.4

31 Jul 15:03
Compare
Choose a tag to compare

What's Changed

  • Fix exceptions comment.

  • The namespaces in the test classes were sorted.

  • Changed the PHPUnit version from 9.0 to 9.5.

  • Fixed blank line at the beginning of the file in FUNDING.yml.

  • release/v2.0.4 in #19

Full Changelog: v2.0.3...v2.0.4

v2.0.3

13 Jul 15:10
Compare
Choose a tag to compare

What's Changed

  • Fixed tags in composer.json.

Full Changelog: v2.0.2...v2.0.3

v2.0.2

13 Jul 14:29
Compare
Choose a tag to compare

What's Changed

  • Improved documentation.

Full Changelog: v2.0.1...v2.0.2

v2.0.1

28 Jun 00:01
f117b89
Compare
Choose a tag to compare

What's Changed

  • pre-release/v2.0.1 in #17

  • release/v2.0.1 in #18

Changes

  • Exceptions were refactored.

  • Changes in documentation.

  • New code style rules have been added.

  • Implemented PSR12 coding standard from all library PHP files.

  • DELETED:

    Josantonius\Json\Json::arrayToFile method.

    Josantonius\Json\Json::fileToArray method.

    Josantonius\Json\Tests\JsonTest class.

  • ADDED:

    Josantonius\Json\Tests\ConstructMethodTest class.

    Josantonius\Json\Tests\GetMethodTest class.

    Josantonius\Json\Tests\MergeMethodTest class.

    Josantonius\Json\Tests\PushMethodTest class.

    Josantonius\Json\Tests\SetMethodTest class.

2.0.0

16 Jun 01:38
563f70e
Compare
Choose a tag to compare
  • The library was completely refactored.

  • Static methods are no longer used.

  • New methods were added to merge and push content in JSON files.

  • The JSON error handling class was removed in preference to a single method.

  • To continue using the version with static methods without the new features:

    • For older versions of PHP (from 5.6 to 7.4), version 1.1.9 of this library can be used.

    • For PHP versions 8.0 and 8.1, version 1.2.0 of this library can be used.

  • Deprecated Josantonius\Json\Json::arrayToFile method.

  • Deprecated Josantonius\Json\Json::fileToArray method.

  • Deleted Josantonius\Json\Exception\JsonException class.

  • Deleted Josantonius\Json\JsonLastError class.

  • Deleted Josantonius\Json\Tests\JsonLastErrorTest class.

  • Added Josantonius\Json\Exception\CreateDirectoryException class.

  • Added Josantonius\Json\Exception\CreateFileException class.

  • Added Josantonius\Json\Exception\GetFileException class.

  • Added Josantonius\Json\Exception\JsonErrorException class.

  • Added Josantonius\Json\Exception\UnavailableMethodException class.

  • Deleted Josantonius\Json\Json::createDirectory method.

  • Deleted Josantonius\Json\Json::saveFile method.

  • Added Josantonius\Json\Json->__construct() method.

  • Added Josantonius\Json\Json->get() method.

  • Added Josantonius\Json\Json->set() method.

  • Added Josantonius\Json\Json->merge() method.

  • Added Josantonius\Json\Json->push() method.

  • Added Josantonius\Json\Json->createFileIfNotExists() private method.

  • Added Josantonius\Json\Json->createDirIfNotExists() private method.

  • Added Josantonius\Json\Json->getFileContents() private method.

  • Added Josantonius\Json\Json->saveToJsonFile() private method.

  • Added Josantonius\Json\Json->checkJsonLastError() private method.

  • Deleted JsonTest->testGetCollection() method.

  • Deleted JsonTest->testArrayToFileCreateFileException() method.

  • Deleted JsonTest->testFileToArray() method.

  • Deleted JsonTest->testFileToArrayCreateFileException() method.

  • Deleted JsonTest->testExternalFileToArray() method.

  • Deleted JsonTest->testExternalFileNonExistentToArray() method.

  • Added JsonTest->itShouldReturnValidInstance() method.

  • Added JsonTest->constructorShouldCreateTheFileIfNotExist() method.

  • Added JsonTest->constructorShouldThrowExceptionIfPathIsWrong() method.

  • Added JsonTest->constructorShouldThrowExceptionIfFilenameIsWrong() method.

  • Added JsonTest->itShouldGetFileContents() method.

  • Added JsonTest->itShouldGetRemoteFileContents() method.

  • Added JsonTest->itShouldSetArrayOnJsonFile() method.

  • Added JsonTest->itShouldSetObjectOnJsonFile() method.

  • Added JsonTest->itShouldThrowExceptionIfSetMethodIsUsedWithRemoteFile() method.

  • Added JsonTest->itShouldMergeArrayOnJsonFile() method.

  • Added JsonTest->itShouldMergeObjectOnJsonFile() method.

  • Added JsonTest->itShouldThrowExceptionIfMergeMethodIsUsedWithRemoteFile() method.

  • Added JsonTest->itShouldPushArrayOnJsonFile() method.

  • Added JsonTest->itShouldPushObjectOnJsonFile() method.

  • Added JsonTest->itShouldThrowExceptionIfPushMethodIsUsedWithRemoteFile() method.

  • Added JsonTest->itShouldThrowExceptionIfFileCannotBeObtained() method.

  • Added JsonTest->itShouldThrowExceptionIfRemoteFileCannotBeObtained() method.

  • Added JsonTest->itShouldThrowExceptionWhenThereAreJsonErrorsInTheFile() method.

  • Added JsonTest->arrayToFileStaticMethodShouldBehaveLikeTheSetMethod() method.

  • Added JsonTest->fileToArrayStaticMethodShouldBehaveLikeTheGetMethod() method.

1.2.0

13 Jun 10:58
e1c1854
Compare
Choose a tag to compare
  • Support for PHP version 8.0 and higher.

  • Support for earlier versions of PHP 8.0 is discontinued.

  • For older versions of PHP (from 5.6 to 7.4) version 1.1.9 of this library can be used.