Download the PHP package tarantool/mapper without Composer
On this page you can find all versions of the php package tarantool/mapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mapper
Tarantool Mapper
- Requirements
- Installation
- Instantiate mapper
- Logging
- Existing types
- Describe entities
- Use migrations
- Use fluent api
- Working with the data
- Indexes
- Array properties
- Sequence plugin
- User-defined classes plugin
- Annotation plugin
- Performance
Requirements
You need latest php major version (8.0 or 8.1), and tarantool latest major branch (2.6, 2.8, 2.10).
Installation
The recommended way to install the library is through Composer:
Create mapper
Usually, you manage dependencies in your service provider. To get started you should instantiate client instance and pass it to mapper constructor. In this example we use PurePacker and StreamConnection. It means you don't need any pecl extensions. To see other implementations please check client documentation
Existing types
You can start with your current configuration. Please, note - all instances are mapped to key-value objects.
Describe entities
To get started you should describe your types and fields using meta object.
Use migrations
Use fluent api
Working with the data
Now you can store and retreive data from tarantool storage using mapper instance.
Indexes
Array properties
You can store arrays as property without any serialization to string.
Sequence plugin
If you want you can use sequence plugin that generates next value based on sequence space. Or you can implement id generator using any other source, for example with raft protocol.
User-defined classes plugin
If you want you can specify classes to use for repository and entity instances. Entity and repository class implementation are ommited, but you should just extend base classes.
Annotation plugin
You can describe your entities using dobclock. Mapper will create space, format and indexes for you.
If you want to index fields, extend repository and define indexes property
Register plugin and all your classes:
Performance
Mapper overhead depends on amount of rows and operation type. Table contains overhead in milliseconds per entity. In some cases, overhead can't be calculated due float precision.
Operation | Counter | Client time | Mapper time | Total time | Client RPS | Mapper RPS | Total RPS |
---|---|---|---|---|---|---|---|
create one | 1 | 0.000 | 0.001 | 0.001 | ∞ | 1,555.174 | 1,555.174 |
single read | 1 | 0.000 | 0.001 | 0.001 | ∞ | 1,634.569 | 1,634.569 |
mass read | 1 | 0.000 | 0.000 | 0.000 | ∞ | 8,774.695 | 8,774.695 |
create one | 10 | 0.000 | 0.002 | 0.002 | ∞ | 4,514.859 | 4,514.859 |
single read | 10 | 0.000 | 0.002 | 0.002 | ∞ | 6,177.178 | 6,177.178 |
mass read | 10 | 0.000 | 0.000 | 0.000 | ∞ | 75,166.738 | 75,166.738 |
create one | 100 | 0.000 | 0.015 | 0.015 | ∞ | 6,467.801 | 6,467.801 |
single read | 100 | 0.000 | 0.012 | 0.012 | ∞ | 8,208.192 | 8,208.192 |
mass read | 100 | 0.000 | 0.000 | 0.000 | ∞ | 314,415.592 | 314,415.592 |
create one | 1000 | 0.000 | 0.141 | 0.141 | ∞ | 7,078.098 | 7,078.098 |
single read | 1000 | 0.001 | 0.116 | 0.117 | 1,000,000.000 | 8,650.659 | 8,576.467 |
mass read | 1000 | 0.001 | 0.001 | 0.002 | 1,000,000.000 | 709,252.555 | 414,948.951 |
create one | 10000 | 0.023 | 1.349 | 1.372 | 434,782.609 | 7,414.542 | 7,290.218 |
single read | 10000 | 0.005 | 1.000 | 1.005 | 2,000,000.000 | 10,003.891 | 9,954.101 |
mass read | 10000 | 0.007 | 0.014 | 0.021 | 1,428,571.429 | 727,699.315 | 482,114.991 |
Perfomance test was made on (intel i5-4670K), Ubuntu 23.10 using PHP 8.3.1 For example, when single select will produce 10 000 entites, you will get about 12s overhead.