Download the PHP package flsouto/fstore without Composer

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

Accessing a Database

A database is nothing more than a directory. So all you have to do is specify the path to that directory when creating a database instance. If the directory does not exist, it will be created when the first row is inserted.

Accessing a Table

You can get a table instance from a database by calling the table method. If the table does not exist, it will be created once the first row is inserted.

Inserting and Retrieving a Row

The table object provides an insert method which accepts an associative array and returns the automatically generated row id:

Outputs:

Getting the Insert Date Based on the Row's ID

The insert method of a table object generates an id which contains the timestamp itself so there is no need to create a "date_added" column. But, in order to avoid conflicts when inserting multiple rows on the same table at the same time the generated id has the miliseconds as well as a counter which guarantees that the ids will always be different, even if inserted on the same nanosecond! So, in order to take the corrrect date/time from this hash you have to remove those extra numbers. The good news is that there is a $table->date method which does just that for you:

Outputs:

Updating a Record

Updating a table record is pretty straightforward: just call update and pass it an associative array followed by the row id:

Outputs:

Deleting a Record

To delete a record simply call $table->delete($id), see example:

Retrieving all IDs from a Table

Use $table->ids() to get all ids:

Outputs:

Retrieving only first 10 IDs from a Table

Use $table->ids(X) to get the first X ids:

Outputs:

Retrieving only the LAST 10 IDs from a Table

Use $table->ids(-X) to get the last X ids:

Outputs:

Querying a Table using Filters

The table object provides a query builder which can be created via $table->query(). This query builder allows us to filter results by means of a $query->filter() function which accepts a callback. The following example illustrates this better:

Outputs:

Querying The Last X Rows...

Call the limit method on a query object and pass it a negative number. See example:

Outputs:

Fetching only one column from the result

Call the values method on a query object passing it the name of the desired column. This will return an array of all values of that column. See example:

Outputs:

Fetching only the ids from a result

Call the ids method on a query object:

Outputs:

Selecting the generated ID as a column

Use the $query->selid($as_key) to include the row id in the result:

Outputs:

Filtering by creation date

Use the $query->since($date) and/or $query->until($date) to filter by creation date. This is faster than filtering by a custom "date" column because it doesn't require the data to be loaded from disk (the comparison is based on the generated ids themselves).

It's also possible to combine both:

The $query->since() and $query->until() methods accept any argument the strtotime() php function would accept as well as a DateTime object or a date in the d/m/Y format.


All versions of fstore with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
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 flsouto/fstore contains the following files

Loading the files please wait ....