Download the PHP
package drmvc/database without Composer
On this page you can find all versions of the php package
drmvc/database. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
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.
Advanced module for work with databases and models.
composer require drmvc/database
It is a specific module, allows you to use multiple databases at the
same time, you can switch database from model class, you can call same
model methods with different databases, you can work with MongoDB and
Mysql from one controller, everything what you want.
Supported databases
For now only databases from list below is supported, but support of
some new databases will be added soon.
Driver
Database
mysql
MySQL and MariaDB
pgsql
PostgreSQL
sqlite
SQLite (file and memory modes)
mongodb
MongoDB (php 7.0 and above only)
Database configuration
You can find few examples of database config files with description
and links here.
Example of MySQL database.php config file:
Where:
default - name of database connection which must be used by default
driver - any driver from this list
prefix - prefix of tables names, required by almost all methods (but not for select() or rawSQL())
How to use
Basic example
A small example of working with a database with the simplest
implementation of the basic CRUD logic, they do not have JOIN, ORDER
and other complex methods, only basic functionality.
Source code of example.php file:
Simple connect to database
Sometimes it is required to implement a system that works directly
with the database object (for example some ORM or custom queries),
for this purpose in Database class the getInstance method was
implemented.
OOP style
As mentioned earlier in this library, implemented basic CRUD support,
that is, you can declare the models dynamically and write simple
queries into the database for which the ORM would be redundant. For
example, you need to insert a row, delete or query all rows from the
table.
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 drmvc/database contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.