Download the PHP package basephp/database without Composer

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

Note: This repository requires the use of the BasePHP framework. If you would like to learn more about the framework, visit BasePHP.

BasePHP Component - Database

Database and Query Builder for BasePHP.

Quick Links:

Installation

(1) Add sensitive information in your .env file

(2) If you do not have the /config/db.php, then copy the db.example.php from this repo and rename it.

Examples

Results:

Update items:

Insert items:

Delete items:

RAW SQL:

Query Builder

These methods are stackable

Method Option Description
table() Required - MUST BE FIRST FROM table
join() Optional JOIN table
select() Optional - Default: * SELECT fields
where() Optional WHERE
in() Optional IN (values)
not() Optional NOT IN (values)
limit() Optional LIMIT number
offset() Optional LIMIT offset,limit
order() Optional ORDER BY fields
group() Optional GROUP BY fields
having() Optional HAVING
distinct() Optional SELECT DISTINCT

Note: For every new query, first use the table() method.

Execute Queries

These methods execute "read" queries and return database results

Method Description
get() Run the query and return all items as a Collection object
first() Run the query and return the first item
last() Run the query and return the last item
count() Run a COUNT query and return the number
sum('field') Get the SUM(field) of a table and return the number
avg('field') Get the AVG(field) of a table and return the number
min('field') Get the MIN(field) of a table and return the number
max('field') Get the MAX(field) of a table and return the number

These methods execute "write" queries

Method Description
update(array) Run the UPDATE query
insert(array) Run the INSERT query, returns insert id
delete() Run the DELETE query
increment(field, value) Run the UPDATE query
decrement(field, value) Run the UPDATE query
truncate() Run the TRUNCATE query

Write a raw query

Method Description
query(string) Write a raw SQL query and return its results

Note: Raw Queries will return results into a Collection, unless you are "writing" to the database.

Note: Queries that use INSERT will return the insert_id automatically

Utility Methods:

Method Description
escape(string) Escape a string for database injection
isWriteSql(string) Checks a string if the SQL statement is write type
isInsertSql(string) Checks a string if the SQL statement is INSERT

Note: all values passed into query methods (not custom SQL's) automatically run through escape()

Database Support

Currently only supports MySQL connections


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
basephp/framework Version <=1.2
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 basephp/database contains the following files

Loading the files please wait ....