Download the PHP package cybrox/crunchdb without Composer

On this page you can find all versions of the php package cybrox/crunchdb. 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 crunchdb

crunchDB - Yet another json database?

Yes, crunchDB is a simple database system written in PHP that is based on storing information in multiple json files. Each json file represents a table and can be accessed and modified via crunchDB. Well, there already are other json based systems, so why creating another one? Actually, though there are a lot of good systems like this out there, I haven't really found anything that offered all the features I wanted in a nice and clear way. Though crunchDB is very simple at the moment, It might get additional functionality to make it more powerful. In it's current state, it is awesome to use for smaller projects like a little chat client. - That's what I wrote it for.

Project structure

This repository contains a src directory which contains all the chrunchDB files. Also, there is an example file to demonstrate some actions. You can download and run this file, it will delete all the changes it made by dropping its created tables after testing.

Features

So, obviously, crunchDB needs to have some sort of functionality. It would be pretty useless otherwise, wouldn't it?
Here's a list of all functions that are currently implemented.

$cdb = new CrunchDB('./db/', 'json', 'rw') Initialize crunchdb with the following parameters:

PLEASE NOTE: crunchDB does not currently support or handle file locking. Thus using it for anything more than simple internal tools (mainly anything with concurrent access, obviously) is highly discouraged!

Method Description
crunchDB->version() Return the current crunchDB version. Useful to see if everything is set up.
crunchDB->tables() List all tables (=files) that are present in this database (=directory).
crunchDB->table('name') Get the object of a crunchDB table cdbTable.
-- --
cdbTable->create() Create a table and its JSON file with the given name.
cdbTable->exists() Check whether or not a table (file) with the given name exists.
cdbTable->truncate() Truncate the given table object.
cdbTable->drop() Drop the given table object and delete its JSON file.
cdbTable->alter('name') Rename the table object's file and table to name.
cdbTable->raw() Get the raw json data of the table's content.
cdbTable->count() Count all rows in this table. This is equal to ->select('*')->count().
cdbTable->insert('data') Insert an array of data, crunchDB will not check it's structure!
cdbTable->select(*1) Select rows from the table, see explanation of *1 below! Returns resouce cdbRes
-- --
cdbRes->sort(*2) Sort rows in the resource, see explanation of *2 below!
cdbRes->sortfn('func') Sort rows in the resource via usort with a custom function (PHP 5.3+)
cdbRes->count() Count all the rows in this resource
cdbRes->fetch() Fetch all the rows in this resource
cdbRes->delete() Fetch all the rows in this resource from the table
cdbRes->update(*3) Update all the rows in this resource from the table, see explanation of *3 below

Parameter explanation

*1 SELECT Parameter

This is the multi-array parameter for select. You can add multiple keys to filter for, for example ['type', '==', 'user'] would search for all rows where the column type equals 'user'. Hereby, the first element is the key to search for, the second one the compare operator (<, <=, ==, >= or >), the third one the respective value to compare and the optional fourth parameter can be an 'and' or 'or'. You can also chain select parameters as following:

*2 SORT Parameter

This is the multi-array parameter for sorting. You can add multiple keys to sort by, for exmaple ['name'] or ['name', SORT_DESC]. Each array can have up to 3 parameters, that being the column name to sort on (mandatory), either SORT_ASC or SORT_DESC (optional) and a projection function (optional).
You can also chain sort parameters as following:

*3 UPDATE Parameter

This is the multi-array parameter for updating. You can add multiple key-vaule pairs to update here like ['name','cybrox']. You can chain as many fields in there as you want to change.

Code examples


All versions of crunchdb with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 cybrox/crunchdb contains the following files

Loading the files please wait ....