Download the PHP package jeroen/json-dump-reader without Composer

On this page you can find all versions of the php package jeroen/json-dump-reader. 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 json-dump-reader

JsonDumpReader

I am not actively developing this library, which might no longer work! You can commission myself and other leading Wikibase experts for Wikibase Software Development or other Wikibase services.

Build Status Scrutinizer Code Quality Code Coverage Download count Latest Stable Version

JsonDumpReader is a PHP library that provides ways to read from and iterate through the Wikibase entities in a Wikibase Repository JSON dump such as the Wikidata JSON dumps. You can find more information about the format on the Wikidata dump download page.

You can hire the authors company Professional Wiki for custom development or for Wikibase hosting.

Usage

All services are constructed via the JsonDumpFactory class:

There are two types of services provided by this library: those implementing DumpReader and those implementing Iterator. The former allow you to ask for the next line of the dump. They are the most low level, with the different implementations supporting different dump file formats (such as .json and .json.bz2). The iterators all depend on a DumpReader, and allow you to easily iterate over all entities in the dump. They differ in how much additional processing they do, from nothing (returning the JSON stings) to fully deserializing the entities into EntityDocument objects.

Reading some lines from a dump

Resume reading from a previous position

Iterating though the JSON

Creating an EntityDocument iterator

The second argument needs to be an instance of Deserializer that can deserialize entities. Such an instance is typically constructed via the Wikibase DataModel Serialization library. For an example of how to do this, see the tests/integration/EntityDumpIteratorTest.php file. Note that this code has additional dependencies.

Combining iterators

The iterator approach taken by this library is lazy and can easily be combined with iterator tools provided by PHP, such as LimitIterator and CallbackFilterIterator.

More documentation and examples

To get documentation that is never out of date and always fully correct for your version of the library, have a look at the public methods in src/JsonDumpFactory.php. Every public method has at least one test, so you can find good examples in the tests directory.

Installation

To use the JsonDumpReader library in your project, simply add a dependency on jeroen/json-dump-reader to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on JsonDumpReader 2.x:

Supported PHP versions:

Installation when using EntityDocument

If you want to use the EntityDocument Iterator, you will also need to install the DataValue libraries used by the Wikibase that created the dump. For Wikidata and typical Wikibase installations these are:

These can be added to the require section in your composer.json as follows. Note that the used versions are current as of August 2018. You can use the latest versions that work for you as no restrictions on these libraries are placed by JsonDumpReader.

Development

Running CI checks and tests locally

If you have PHP and Composer installed locally, you do not need Docker and can just execute composer commands.

For tests only

composer test

For style checks only

composer cs

For a full CI run

composer ci

Docker: installation

You can develop without having a local installation of PHP or Composer by using Docker. Install it with

sudo apt-get install docker docker-compose

Docker: Running Composer

To pull in the project dependencies via Composer, run:

make composer install

You can run other Composer commands via make run, but at present this does not support argument flags. If you need to execute such a command, you can do so in this format:

docker run --rm --interactive --tty --volume $PWD:/app -w /app\
 --volume ~/.composer:/composer --user $(id -u):$(id -g) composer composer install --no-scripts

Where composer install --no-scripts is the command being run.

Docker: Running the CI checks

To run all CI checks, which includes PHPUnit tests, PHPCS style checks and coverage tag validation, run:

make

Docker: Running the tests

To run just the PHPUnit tests run

make test

To run only a subset of PHPUnit tests or otherwise pass flags to PHPUnit, run

docker-compose run --rm app ./vendor/bin/phpunit --filter SomeClassNameOrFilter

Release notes

Version 2.0.0 (2018-08-14)

Version 1.4.0 (2017-03-03)

Version 1.3.0 (2015-11-23)

Version 1.2.0 (2015-11-23)

Version 1.1.0 (2015-11-12)

Version 1.0.1 (2015-11-10)

Version 1.0.0 (2015-11-08)

Version 0.2.0 (2015-09-29)

Version 0.1.0 (2014-10-22)

Initial release with

See also


All versions of json-dump-reader with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
jeroen/rewindable-generator Version ~1.1
wikibase/data-model-serialization Version ~1.1|~2.0
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 jeroen/json-dump-reader contains the following files

Loading the files please wait ....