Download the PHP package tobento/service-database without Composer

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

Database Service

With the Database Service you can create and manage databases easily.

Table of Contents

Getting started

Add the latest version of the Database service project running this command.

Requirements

Highlights

Documentation

Databases

Create Databases

Add Databases

add

register

You may use the register method to only create database if requested.

Get Database

If the database does not exist or could not get created it throws a DatabaseException.

You may use the has method to check if a database exists.

Default Databases

You may add default databases for your application design.

PDO Database

Create PDO Database

Pdo Database Factory

You may use the factory to easily create a database.

createDatabase

createPdo

Using PDO Database

Use the execute method to excute any prepared statements.

select

insert

update

Execute a insert statement returning the number of rows affected.

delete

Execute a delete statement returning the number of rows affected.

transaction

You may use the transaction method to run a set of database operations within a transaction. If an exception is thrown within the transaction closure, the transaction will automatically be rolled back. If the closure executes successfully, the transaction will automatically be committed.

commit

rollback

supportsNestedTransactions

PDO

Migration

Table Schema

Table schemas are used by Storages for migration processing.

Column Types

Available Types

Type Parameters Lengthable Nullable Defaultable Unsignable Description
primary name: 'column' yes no no yes Usually mapped as int, auto-incrementing and added as primary index column.
bigPrimary name: 'column' yes no no yes Usually mapped as bigint, auto-incrementing and added as primary index column.
bool name: 'column' no no yes no Some databases will store it as tinyint (1/0).
int name: 'column', length: 11 yes yes yes yes -
tinyInt name: 'column', length: 1 yes yes yes yes -
bigInt name: 'column', length: 20 yes yes yes yes -
char name: 'column', length: 255 yes yes yes no -
string name: 'column', length: 255 yes yes yes no -
text name: 'column' no yes yes no -
double name: 'column' no yes yes no -
float name: 'column' no yes yes no -
decimal name: 'column', precision: 10, scale:0 no yes yes no -
datetime name: 'column' no yes yes no -
date name: 'column' no yes yes no -
time name: 'column' no yes yes no -
timestamp name: 'column' no yes yes no -
json name: 'column' no yes yes no -

Lengthable

To set a column length.

Nullable

To set column as NOT NULL, use nullable method with false as parameter:

Defaultable

To set a default value for the column.

Unsignable

To set column as UNSIGNED.

primary / bigPrimary

Primary and bigPrimary columns will only be set while creation.

Rename and Drop

renameColumn

dropColumn

renameTable

dropTable

truncate

Column Parameters

charset

You might set the charset of the column.

collation

You might set the collation of the column.

Indexes

Simple index

Compound index

Simple unique index

Compound unique index

Primary index

Rename index

Drop index

Foreign Keys

No supported yet!

Items and Seeding

Items

chunk

You may play around with the chunk length parameter for speed improvements while having many items.

useTransaction

If set to true, it uses transaction while proccessing if the database supports it.

forceInsert

If set to true, it will always inserts the items, otherwise they will only be inserted if there there are not items yet.

Item Factory

You may use the item factory iterator to seed items and use the Seeder Service to generate fake data.

Json File Items

Table Factory

You may use the table factory to create a table.

Column Factory

You may use the column factory to create a column.

createColumn

Check out the supported Column Types for its type name.

createColumnFromArray

Lengthable, Nullable, Defaultable, Unsignable and Parameters column definitions:

Index Factory

createIndex

createIndexFromArray

Other parameter definitions:

Processors

Processors are used to process the table on the specified database.

Pdo MySql Processor

The proccessor will automatically determine if to add or modify table columns and indexes.

You may create a Pdo MySql Storage will query the database to create the current table as to determine modifications.

Stack Processor

You may use the "stack processor" to support multiple databases. Only the first processor which supports the specified database will process the action.

Storages

Storages are used to fetch the current table or store the processed.

Pdo MySql Storage

fetchTable

The storage will query the database to create the current table.

storeTable

No table data is stored as fetching will create the table.

Stack Storage

You may use the "stack storage" to support multiple databases. Only the first storage which supports the specified database will process the action.

Custom Storage

You may create custom storages for proccssors or as standalone usage.

Security

:warning: Avoid using user provided data for creating Table Schema without a proper whitelist!

Migrator

You might install and use the Migration Service for migration processing.

Create Migration

Create a migration class by extending the .

Using the method

You may use the method to register the table for the install and uninstall process.

Check out the Table Schema for its documentation.

Using the and methods

You may use the and methods for specifing the actions by your own.

Check out the Table Schema for its documentation.

Create Migration Seeder

First, you will need to install the Seeder Service and bind the implementation to your container in order to get injected on the .

Next, create a migration seeder class by extending the .

Then use the method to register the table for the install process.

Check out the Seeder Service for its documentation.

Check out the Table Schema for its documentation.

Install And Uninstall Migration

Check out the following migration service documentation to learn more about it.

Credits


All versions of service-database with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
tobento/service-filesystem Version ^1.0
tobento/service-iterable 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 tobento/service-database contains the following files

Loading the files please wait ....