Download the PHP package jlaso/simple-memory-db without Composer

On this page you can find all versions of the php package jlaso/simple-memory-db. 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 simple-memory-db

jlaso/simple-memory-db

Build Status

A simple db in memory, that has to be populated from JSON data.

It lives entirely in memory, quick to access data and manipulate in order to process data at very high speed.

Installation

You need only to require this package in your project

Look at the Examples folders to see how to use it

Example

You have a very simple example with two tables: customers and taxes, each customer has a tax_type associated.

In order to implement your data you have to create a class extending AbstractTable and declare the property $indexMap

by default is automatically indexed. So, this field is mandatory in every table, must come in the json.

BigExample

You can just squeeze it in order to know how big is the limit of this database is in your system.

In order to populate the memory tables with real data, the json files can be generated parametrically:

And to see the results

ProcessRecord

If you need to add some extra fields or process the records somehow when they are loaded in memory you can implement the method in your table

Modifier methods

Although is not a real database you can insert new elements or remove the existent ones:

Insert

This insert the new record in memory and updates the indices to make it accessible. $data can be an array or an object that implements the JLaso\SimpleMemoryDb\ToArrayInterface

Update

This is an alias for insert, currently insert just replaces the existent copy of the record inserted if any.

Remove

This removes the record pointed by and updates the indices to make it not accessible.

Storing method

And, why not ... dump it into a json file again.

Find methods

find($id)

Just fetches the current record pointed by $id or null if does not exist.

findAll($field, $value, $filterCallback)

if $field and $value are null returns all the records.

Always passes the record to $filterCallback being to added in order to know if passes the filter. Obviously if $filterCallback is null no filter applied.

You can check the examples on the Tests folder.

Exceptions

Since version 1.5 added the property $notFoundThrowsException in order to throw or not an Excepcion in the case the record is not found.


All versions of simple-memory-db with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
fzaninotto/faker Version ^1.6
dariuszp/cli-progress-bar Version ^1.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 jlaso/simple-memory-db contains the following files

Loading the files please wait ....