Download the PHP package imjoehaines/flowder without Composer

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

Flowder Latest Stable Version

Flowder is a (really) simple fixture loader for PHP 7.3+, supporting SQLite and MySQL.

Using Flowder in PHP 7.2 or below? Try version 1 instead!

NB: If you're looking to use Flowder in a project, you probably want to use an exisiting framework integration:

Basic Concepts

Flowder is built with three basic building blocks; Persisters.

A Loader is responsible for taking a thing to load (such as a file or directory) and converting it into an array of data that can be persisted.

A Truncator is responsible for ensuring all the database tables where data will be persisted are empty before persisting the data.

A Persister is responsible for taking the data provided by a Loader and inserting it into the database.

These three concepts are represented by the following interfaces:

Building your own Loaders, Truncators and Persisters is as easy as creating a class that implements ones of these interfaces.

Usage

Loading fixtures with Flowder takes a few lines of code — it just requires a Loader, Truncator and Persister.

For example, to load a single PHP file into a SQLite in-memory database, the following file could be used

Provided Classes

Flowder

Flowder is the main class you will be using. It is responsible for orchestrating the loading, truncating and persisting processes.

As seen in the example above, it is constructed with three arguments — an instance of LoaderInterface, an instance of TruncatorInterface and an instance of PersisterInterface.

After construction, call loadFixtures and pass it a thing to load in order to persist the data. For example, using the PhpFileLoader you would pass loadFixtures the path to a PHP file.

Loaders

Flowder comes bundled with three Loaders:

PhpFileLoader

This Loader takes a PHP file name, requires it and uses a returned array of data as the data to be persisted. The file name itself is used as the table name (ignoring the file extension).

For example, given the following example_table.php file

Then when loaded with the PhpFileLoader, it would return the following PHP array

DirectoryLoader

The DirectoryLoader is a decorator around another Loader instance that will run the Loader's load method for each file in the directory provided to DirectoryLoader::load.

For example, the following code will load all files in /some/directory using the PhpFileLoader

CachingLoader

The CachingLoader is another decorator that caches the result of it's load method so that repeated calls to load the same thing will return the same result as it did on the first call to load.

Extending the above example, we can use the following code to load all files in /some/directory using the PhpFileLoader, but only actually hit the disk on the first time through the for loop. All other iterations will simply return the cached value

It is usually a good idea to use the CachingLoader whenever you are loading the same resource more than once as it can dramatically speed up fixture loading.

Additional Loaders

For loading file formats other than PHP, take a look at the JSON or YAML loaders:

Truncators

Flowder comes with two Truncator classes:

MySqlTruncator

This Truncator takes a table name and runs a MySQL TRUNCATE TABLE query on it. It will disable foreign key checks before the truncate and enable them afterwards, to ensure ordering of truncation does not matter. It is your responsibility to make sure this does not leave your database in an inconsistent state after all of your fixtures run.

SqliteTruncator

This Truncator takes a table name and runs a DELETE FROM query on it. Like the MySqlTruncator, it will disable foreign key checks before the truncate and enable them afterwards.

Persisters

MySqlPersister

The MySqlPersister takes a table name and array of data and converts it into a single INSERT query. Like the MySqlTruncator it will disable foreign key checks before the insert and enable them afterwards to ensure the ordering of inserts does not matter. It is your responsibility to make sure this does not leave your database in an inconsistent state after all of your fixtures run.

SqlitePersister

The SqlitePersister is functionally identical to the MySqlPersister, but inserts data a row at a time inside a transaction instead of building a single INSERT query. This is to get around SQLite's SQLITE_MAX_VARIABLE_NUMBER limitation.


All versions of flowder with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
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 imjoehaines/flowder contains the following files

Loading the files please wait ....