Debian Codegraph @

vendor/wikimedia/cdb/README.md

raw
1 [![Latest Stable Version]](https://packagist.org/packages/wikimedia/cdb) [![License]](https://packagist.org/packages/wikimedia/cdb)
2
3 CDB functions for PHP
4 =====================
5
6 [CDB][], short for "constant database", refers to a very fast and highly
7 reliable database system which uses a simple file with key value pairs. This
8 library wraps the CDB functionality exposed in PHP via the `dba_*` functions.
9 In cases where `dba_*` functions are not present or are not compiled with CDB
10 support, a pure-PHP implementation is provided for falling back.
11
12 Additional documentation about the library can be found on
13 [mediawiki.org](https://www.mediawiki.org/wiki/CDB).
14
15
16 Usage
17 -----
18
19 ```php
20 // Reading a CDB file
21 $cdb = Cdb\Reader::open( 'db.cdb' );
22 $foo = $cdb->get( 'somekey' );
23
24 // Writing to a CDB file
25 $cdb = Cdb\Writer::open( 'anotherdb.cdb' );
26 $cdb->set( 'somekey', $foo );
27 ```
28
29 // Using the CLI
30 $ cdb ./myfile.cdb [get|list|match] <parameter>
31
32
33 Running tests
34 -------------
35
36 composer install --prefer-dist
37 composer test
38
39
40 History
41 -------
42
43 This library was first introduced in [MediaWiki 1.16][] ([r52203][]). It was
44 split out of the MediaWiki codebase and published as an independent library
45 during the [MediaWiki 1.25][] development cycle.
46
47
48 ---
49 [CDB]: https://en.wikipedia.org/wiki/cdb_(software)
50 [MediaWiki 1.16]: https://www.mediawiki.org/wiki/MediaWiki_1.16
51 [r52203]: https://www.mediawiki.org/wiki/Special:Code/MediaWiki/52203
52 [MediaWiki 1.25]: https://www.mediawiki.org/wiki/MediaWiki_1.25
53 [Latest Stable Version]: https://poser.pugx.org/wikimedia/cdb/v/stable.svg
54 [License]: https://poser.pugx.org/wikimedia/cdb/license.svg