Download the PHP package lrc-se/anax-repository without Composer

On this page you can find all versions of the php package lrc-se/anax-repository. 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 anax-repository

Anax Repository

Latest Stable Version Travis CI Build Status Scrutinizer Build Status Scrutinizer Code Quality Scrutinizer Code Coverage

Repository module for the modular Anax framework, providing model-based data access through a consistent interface. As of now the included implementation works with relational databases only.

This module is intended as a replacement for the existing ActiveRecordModel in anax/database, offering a better semantic fit for the underlying data source while also being easier to manage and test, especially from a dependency injection standpoint.

The module also offers automatic soft-deletion capabilities available on demand.

Requirements

Usage

To use this module in an Anax installation, install it with composer require lrc-se/anax-repository. The module as such requires no configuration, but expects an instance of a properly configured DatabaseQueryBuilder from anax/database to perform the actual database operations.

DbRepository

Implementation of RepositoryInterface. Construction parameters:

$db,            // Anax database service (query builder)
$table,         // Name of the database table the repository represents
$modelClass,    // Name of the model class representing each repository entry
$key            // Name of the primary key column (optional, defaults to 'id')

Examples:

Refer to RepositoryInterface for a full description of the main API.

SoftDbRepository

Implementation of SoftRepositoryInterface, adding soft-deletion awareness. Construction parameters:

$db,            // Anax database service (query builder)
$table,         // Name of the database table the repository represents
$modelClass,    // Name of the model class representing each repository entry
$deleted,       // Name of the attribute used to flag deletion (optional, defaults to 'deleted')
$key            // Name of the primary key column (optional, defaults to 'id')

Examples:

Refer to SoftRepositoryInterface for a full description of the extended API.

ReferenceResolverTrait

Note: This feature is deprecated in favor of managed repositories explained below.

Include in model class to get access to foreign key reference resolution. Method invocation:

$model->getReference(
    $repository,        // Repository to query
    $attr,              // Name of the foreign key attribute
    $key                // Name of the referenced attribute (optional, defaults to 'id')
);

This method returns null if no matching referenced entry can be found.

Example:

SoftReferenceResolverTrait

Note: This feature is deprecated in favor of managed repositories explained below.

Include in model class to get access to foreign key reference resolution, taking soft-deletion into account. Method invocation:

$model->getReferenceSoft(
    $repository,        // Soft-deletion-aware repository to query
    $attr,              // Name of the foreign key attribute
    $key                // Name of the referenced attribute (optional, defaults to 'id')
);

This method returns null if no matching non-deleted referenced entry can be found.

Example:

RepositoryManager

Manages repositories in an application, allowing for fully automatic reference resolution based on model classes. The keys in the config array for createRepository() are the same as the construction parameters for the repository implementations above, save for db which is the database service and type which specifies which repository class to instantiate; currently supported values are "db" for DbRepository or "db-soft" for SoftDbRepository (the latter is the default). Also note that the model class remains a separate parameter.

Example:

ManagedRepository

This base class uses ManagedRepositoryTrait to provide fully automatic foreign-key resolution together with the repository manager above and the managed models below. Immediate retrieval goes one level deep per reference, after which on-demand fetching has to be used. DbRepository and SoftDbRepository inherit from this class and implement all necessary functionality to take advantage of the reference system laid out in the next section.

ManagedModelTrait/SoftManagedModelTrait

Provides fully automatic foreign-key resolution together with RepositoryManager and ManagedRepository above. Use the following parameter format for setReferences() to declare foreign references:

[
    'name' => [         // reference name
        'attribute',    // foreign key attribute
        'model',        // model class of referenced entity
        'key',          // primary key of referenced entity (defaults to 'id')
        'magic'         // whether to make the reference available as a magic model attribute
    ],
    ...
]

Example:

Notes

The module anax/configure is not a dependency of this module per se, but it is required by DatabaseQueryBuilder and is therefore included in the require-dev section of composer.json in order for the unit tests to work. Also note that before v1.1.6 of anax/database this requirement was for anax/common instead.

Additionally, anax/database is not actually required as such, only a corresponding implementation of its DatabaseQueryBuilder class providing the same public API, but it has been included as a dependency for simplicity's sake.

About

Type: School project @BTH
License: MIT
Author: LRC


All versions of anax-repository with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
anax/database Version ^1.1.6
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 lrc-se/anax-repository contains the following files

Loading the files please wait ....