Download the PHP package dottwatson/fpdo without Composer

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

What is fpdo?

Fpdo is a versatile tool that allows you to cross-reference data from different sources simply by using the SQL queries you use daily for your MySQL database. Each source is handled as a classic SQL table, described with the blueprints used by Laravel. The package is based on a modified version of https://github.com/vimeo/php-mysql-engine, the core engine of the entire tool.

Installation

composer require dottwatson/fpdo

for the configuration go to section configuration

Creating a Database

First, let's create a connection in Laravel's database configuration file:
config/database.php

In this way, we define the database in the classic Laravel manner, except that the actual database will be defined through a dedicated class. In this example, I create a folder in the system that will host our database definition in app\FpdoDatabases.

app --
    |--FpdoDatabases
        |--TestFpdo
            |--Database.php
            |--Tables
                |--Categories.php
                |--Products.php

Source of app/FpdoDatabases/TestFpdo/Database.php:

Now let's define a database table. In this example, we use a JSON file in our storage: app/FpdoDatabases/TestFpdo/Tables/Products.php

In this example, reader is executed to read the data and must return an array of key-value pairs of all data records. writer is responsible for writing data wherever needed (in this example, it rewrites the same JSON file). However, if you don’t need to write data, writer can remain empty but must always be present (due to the abstract class model).

Notes: To optimize resources, all data from the tables will be loaded only when needed. This means that if you configure 20 tables, but only query 2, the data from the tables concerned will be loaded. This is called lazy loading.

That's it! Everything else remains the same for your application, such as models, relationships, direct queries, and so on.

Limitations

Basic limitations are described in https://github.com/vimeo/php-mysql-engine. However, the following features have been implemented: BOOLEAN COLUMN - Boolean column alias of tinyint
JSON COLUMN - The JSON column, of course!
JSON FUNCTIONS - The full set of JSON functions as described in https://dev.mysql.com/doc/refman/8.4/en/json-function-reference.html, except for JSON_TABLE, JSON_VALUE, MEMBER_OF.

Note: JSON functions do not support the ** selector.

Additionally, two functions have been implemented for direct query interaction with PHP: PHP_CALL: Accepts at least one parameter representing the function name, or a JSON array with the class and method names. All other parameters will be passed to the callable.

or

PHP_EVAL: Executes PHP code.

Custom SQL Functions

You can extend fpdo with custom functions to use in your queries as if they were native functions.

Creating a function evaluator:

adding it in the config/fpdo.php

and its usage

Configuration

To have the configuration file in the config folder of your application:

Below is a table describing the parameters:

Parameter Value Type Explanation
default_charset string The default charset used for tables (and databases) where it is not otherwise defined.
default_collation string The default collation used for tables (and databases) where it is not otherwise defined.
slow_query_log boolean The slow query log consists of SQL statements that take more than long_query_time seconds to execute.
long_query_time int Expressed in seconds. Set to -1 to log every query and its execution time.
log_channel string According to your logging configuration, select your logging channel.
slow_read_log boolean The slow read log consists of data retrieval from table::read() that takes more than long_read_time seconds to execute.
long_read_time int Expressed in seconds. Set to -1 to log each read operation's time to populate tables.
write_on_end boolean The writing logic is a special setting that makes the system faster by avoiding long write processes. When a record is inserted, updated, or deleted, the table needs to be saved to the original source, which takes time if done for each modified record. With this parameter set to true, modifications stay in memory and are written at the end of execution. If enabled, any fatal error during execution will result in all in-memory data being lost!
slow_write_log boolean The slow write log consists of data writes from table::write() that take more than long_write_time seconds to execute.
long_write_time int Expressed in seconds. Set to -1 to log each write operation's time to save tables.
extensions array Extend fpdo with your custom function set. Use class names.

That's it!

If you like this package, consider to buy me a ☕coffee


All versions of fpdo with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8
ext-pdo Version *
dottwatson/php-mysql-engine 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 dottwatson/fpdo contains the following files

Loading the files please wait ...