Download the PHP package mhmmdq/database without Composer

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

Query builder class php

This class is responsible for creating and executing sql commands and helps you to execute as easily as possible and safely.

Installation

You can use a composer to install the package

How to connect to the database

To connect to the database, you need to send data to the connection class, which must be done as follows

Driver The type of database driver to connect

Host Database server

Port Database port - 3306 by default

Username Database login username

Password Database login password

Charset String encoding type - utf8mb4 by default

Collation Letter comparison method - a default of utf8mb4_general_ci

Database Database name

Methods of receiving data

There are different types of methods defined for retrieving data from a database that you can use

Query the builder query class

You must first add a query builder class to your work

Select the table name

To select a table name, use the table method and give it the name of the desired table as input

Capture all table outputs

You can use the get method to get all the records of a table and run a query

But if you want to have Json output, you can get help from toJson

In this case, you also change the type of file sent to json. If you do not want this to happen, enter false toJson function.

You can even receive output as a presentation

Number of outputs per query

The number of all output rows is available as follows

Select custom column names

You can output from any column you just need to use the select method

Sorting outputs

Adjust the display of outputs

Applied methods

count()

Count all rows in a table in primarykey

max()

Find the largest value of a column in a table

min()

Find the smallest value of a column in a table

Restrict outputs by performing operations where

You can use the where method to receive filtered data

The first type of use

Restriction based on primarykey Normally the primarykey is equal toid. You can do this to change

Now, if you do not need this function, you can directly use the following method to filter with id value

Here only the user with an id equal to 6 is displayed. In fact, the following query is executed

The second method uses where

If you are looking for a column other than the primary key, you can do this

In this case, from the users table of the username column, only the user with the username mhmmdq is selected and the following query is executed

The second method uses where to change the operator

If you want to use another operator to search for another column, you can do the following

Multiple use of where

You can use any amount you want where

Limitation by number

If you want to display a certain number of records

Get the first output

Find method and findorfail

find()

This method uses a template to find a record in the database and displays the output

If you want to output with another data type, you can enter json or array as the last input

findOrFial()

This function allows you to go to page 404 if there is no record with the specifications, but you need to specify the location of the view file.

After the introduction, if the output is zero, it will be transferred to page 404

Pagination

Output pagination of database records along with page links Follow the steps below to paginate

In this way, 5 users are displayed on each page Note that after enabling this feature, $ _GET ['p'] is used by the class to identify the current page

Get links to pages

In the simplest way possible, just print

But if you want to personalize

This is the way it works

Record data in the database

To register information in the database, you will spend a little time, just enter the data as a presentation to the insert method to enter the information into the database.

The information is easily entered into your database, but it is still there. If you need validation, you can leave it to us.

validation

Available validation methods

max:value Maximum allowed characters

min:value Minimum allowed characters

email Check the authenticity of the email

uniq Unique search without data

Make a array and get started

And now insert the variable

Now, before registration in the database, validation is done

Editing database data

Editing information is as simple as the rest of the operations

update($table , $data , $where ,$validate)

Delete records from the database

delete($table ,$where)


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
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 mhmmdq/database contains the following files

Loading the files please wait ....