Download the PHP package lambdacasserole/condense without Composer
On this page you can find all versions of the php package lambdacasserole/condense. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package condense
Condense
Flat-file database in PHP.
Based on the Fllat and Prequel libraries by Wylst. Special mention for Alfred Xing who seems to be the main contributor behind both. With added support for:
- Encrypted databases using php-encryption by Taylor Hornby
- Composer via Packagist
Installation
Install Condense via Composer like this:
Or alternatively, if you're using the PHAR (make sure the php.exe
executable is in your PATH):
Usage
To initialize a new database or load an existing one, do this.
This will, by default, create a file db/employees.dat
or load that file, if it already exists. You can change the path at which the flat file database will be created thusly.
The constructor also accepts a third parameter which allows you to specify a key to use to encrypt the database with.
When loading the database again, this same password must be used.
Create
Use insert
to add a record (row) to the database.
Retrieve
Condense provides several methods for data retrieval.
One Value
Use the get
method. Specify a field name, another field name, and a value. It will return the value of the first field where (in the same row), the value of the second field matches the given value.
Field Subset
Use the select
method. Returns some (or all) fields in a table, specified by giving an array of desired field names.
Update
Condense provides a couple of methods for updating existing data in a database.
One Field
Use the to
method to update one field for any row satisfying a condition.
One Row
Use the update
method to update a row by index.
Delete
Use the remove
method to delete a row in the database.
Caveats
This is a flat file database system. It removes the headache of setting up and configuring a database server, but introduces a few of its own:
- I/O will be much slower due to many disk read/write actions
- Encrypting a database will hugely affect performance
- Bugs may arise due to concurrency issues
- Misconfigured web applications using this library may accidentally allow their databases to be downloaded over HTTP