Download the PHP package hawkbit/database without Composer

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

Hawkbit Database

Latest Version on Packagist Build Status Total Downloads Coverage Status

Object orientated database handling with POPO's, unit of work, identity map and data mapper.

Install

Using Composer

Hawkbit Database is available on Packagist and can be installed using Composer. This can be done by running the following command or by updating your composer.json file.

composer.json

Be sure to also include your Composer autoload file in your project:

Downloading .zip file

This project is also available for download as a .zip file on GitHub. Visit the releases page, select the version you want, and click the "Source code (zip)" download button.

Requirements

The following versions of PHP are supported by this version.

Usage

Connect and go!

  1. Register a connection
  2. Register a Mapper if you need to work with Unit of Work and Mappers
  3. Have fun!

Examples

We also provide Examples for following documentation.

Connections

Shared Connections

In huge applications, you need to be able to access connections at many points. Simply share your connection

You may want to save time or lines of code and add connection directly

and access connection at another point of your application

Multiple connections

In some cases you need two ore more connections. Therefore connections could have a name, the default name is default (Hawkbit\Database\ConnectionManager::DEFAULT_CONNECTION).

Prefixing

On a shared database it is use full to to prefix tables with a specific name, e.g. application abbreviation. You need to set the prefix on your connection. The system is prefixing all table names automatically.

Add PHP 7.1 support

As you can see you (as do mapper) pass the tablename and internally the tablename will be prefixed.

Migration

Easy schema setup with SQL
Advanced Migration with phinx

Schema migration is not provided by this Package. We recommend packages like Phinx for advanced migration.

Gateway

The gateway mediates between database and mapper. It is able to execute table or view specific operations and provides CRUD queries.

Create a new gateway from connection

Create

Create a new entry

Read (select)

Fetch entries as array (refer to \PDO::FETCH_ASSOC). Entries do have following array representation

You could also use doctrines expression builder combined with QueryBuilder::createPositionalParameter and QueryBuilder::createNamedParameter for more complex queries!

Update

Update an entry

Delete

Delete an entry

Mapper

Data mapper

The data mapper is mapping data to entities and extracting data from entities. The mapper is also aware of database table configuration and converts data types into both directions - PHP and database. It utilizes an [Identity Map]() which ensures that an object is only load once.

Example mapper configuration

It is recommended to extend the mapper with custom logic for accessing associated data or other specific data sets. Data association / Data relation are not supported at this point!

The combination of mapper and entities may have the flavor of Table-Data-Gateway with passive records.

Entities

Entities represent a single entry (row) of a database table or view. It is a set of Setters and Getters, without any logic - passive record. Entities are Plain Old PHP Objects (POPO)

Example entity

Prepare and load mappers

Register mapper to mapper locator to preload configuration and ensure access. An Exception is thrown when locator is unable to find a mapper.

Locate a registered mapper

Locate a registered mapper by entity

Create entity from mapper, if you don't want to create a new instance of entity

Modify data

The mapper is able determine entity state and save (create or update) data. The mapper is modifying the same entity instance. All changes which have been made in database are also stored into the entity at the same time.

Create

Create an entry

Update

Update an entry

Save

The mapper is also able to detect a new or existing entity and choose to create or update an related entry in database.

Delete

Delete an entry

Fetching data

Find

Find entry by primary key or compound key and return a single entity result or false

Custom select

Fetch entries as a list of entities. Entries do have following representation

A select is taking all valid kinds of callable to modify the query.

Fetch only one entry will return an entity instead of an entity list

Transactions (Unit of Work)

For data consistency you want to use transactions. Basically all queries are wrapped with a transaction and automatically committed if auto-commit option is enabled. You could also create, update and delete a huge set of data and commit them a once.

Build-in doctrine transaction

To use a unit of work, you need to register a mapper. In some cases, like prototyping you want use gateway for quick access. Therefore you should use build-in transaction.

Unit of Work - Transaction with mappers

Transactions need registered mappers to work correctly.

Modify you data in any order, unit of work is sorting the execution of create, update and delete for you. If all modifications are done, you need to execute UnitOfWork::commit Please refer to the following example of unit of work:

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
doctrine/dbal Version ~2.5
doctrine/inflector Version ~1.1
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 hawkbit/database contains the following files

Loading the files please wait ....