Download the PHP package fsi/datasource without Composer

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

FSi DataSource Component

DataSource allows to fetch data from various sources using different drivers. It supports pagination and through fields (that driver or its extensions must provide) allows to give various conditions, that fetched data must fulfill.

DataSource to fetch specific kind of data (from database, xml, json, etc.) must be created with properly configured driver, that will implement methods to get that kind of data.

Available drivers

Basic usage

Let's assume we want to create DataSource with DoctrineDriver (you can find documentation for specific drivers in doc folder) that allows us to fetch some data through Doctrine ORM. For our example let's assume we have a News object (entity) with id, title, author, create date, short content and content. We will need only a $managerRegistry instance. Then we can create $datasource instance.

Then, if we want to give some conditions for returned data we need to specify fields, their type and way of comparison.

If we have configured DataSource we can bind some parameters to it.

We can also set proper pagination.

And at last we can fetch our data

or create view helpfull during view rendering (see below for more info).

Result that is returned always implements Traversable interface.

Note, that in fact all you need to do to fetch data is create DataSource and call getResult method, other steps are optional.

View

While view rendering you should use DataSourceView. It's main purpose is to keep some attributes given by extensions, that are needed to render various links, paginations, etc. For more details see documentation of extensions in doc folder.

To get these attributes you can use methods hasAttribute, setAttribute, getAttribute, getAttributes and removeAttribute.

View also have three methods to get parameters of current datasource, other ones on page or all of them (in case there is more than one DataSource on page), these methods are: getParameters, getAllParameters and getOtherParameters. Parameters you get allows you to regenerate actual state of DataSource (what means if you bind parameters you got from getParameters DataSource will be in the same state it was before binding).

These methods return multidimensional array, so it's up to you to transform it to state that is suitable to send as GET parameters (like name[param1][param2]).

View contains also FieldViews (one for each field, described below). You have various ways to get to them, since View implements ArrayAccess, Countable, and SeekableIterator.

Note: Remember you can't set anything using ArrayAccess interface, constructions like unset($view['field1']) or $view['field2'] = 'sth' won't work.

FieldView

FieldView allows to set some specific attributes that relates to that specific field. You can access them by the same methods like in View: hasAttribute, setAttribute, getAttribute, getAttributes and removeAttribute.

To see which attributes are set in which case see extensions docs.

Extensions

You can find available extensions documentation in doc folder.

In general there are three types of extensions: DataSource extensions, Driver extension, and Field extensions.

All parts of this component use Symfony's EventDispatcher (Symfony\Component\EventDispatcher\EventDispatcher) to manage events.

DataSource extensions

Each extension must implement interface FSi\Component\DataSource\DataSourceExtensionInterface. Method loadSubscribers must return array of objects that (if any) must implement Symfony\Component\EventDispatcher\EventSubscriberInterface. Method loadDriverExtensions must return array of objects that (if any) must be valid driver extensions (see below).

Each of subscribers can subscribe to one or many of following events: (list contains key, that is const of FSi\Component\DataSource\Event\DataSourceEvents and event method's argument, which is defined in FSi\Component\DataSource\Event\DataSourceEvent namespace)

All of arguments allows to access DataSource through getDataSource method.

Arguments:

Driver extensions

Each extension must implement interface FSi\Component\DataSource\Driver\DriverExtensionInterface. Method loadSubscribers must return array of objects that (if any) must implement Symfony\Component\EventDispatcher\EventSubscriberInterface.

Driver extension must implement method getExtendedDriverTypes() which returns types of drivers that this extension is suitable for.

Driver extension provides field types through methods hasFieldType and getFieldType, where getFieldType must return field object for given type, that implements FSi\Component\DataSource\Field\FieldTypeInterface and already has all its extensions loaded.

Each of subscribers can subscribe to one of following events: (list contains key, that is const of FSi\Component\DataSource\Event\DriverEvents and event method's argument, that is defined in FSi\Component\DataSource\Event\DriverEvent namespace)

Arguments:

Extension for Field

Each extension must implement interface FSi\Component\DataSource\Field\FieldExtensionInterface Method loadSubscribers must return array of objects that (if any) must implement Symfony\Component\EventDispatcher\EventSubscriberInterface.

Field extension must implement method getExtendedFieldTypes() which returns types of fields that this extension is suitable for.

Each of subscribers can subscribe to one of following events: (list contains key, that is const of FSi\Component\DataSource\Event\FieldEvents and event method's argument, that is defined in FSi\Component\DataSource\Event\FieldEvent namespace)

All of arguments allows to access Field through getField method.

Arguments:


All versions of datasource with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
symfony/event-dispatcher Version ^3.4|^4.0
symfony/options-resolver Version ^3.4|^4.0|^5.0
fsi/data-indexer Version 0.9.*|^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 fsi/datasource contains the following files

Loading the files please wait ....