Download the PHP package davidecesarano/embryo-pdo without Composer

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

Embryo PDO

A quick and light PHP query builder using PDO.

Requirements

Installation

Using Composer:

Usage

Connection

Create a multidimensional array with database parameters and pass it at the Database object. Later, create connection with connection method.

Retrieving results

You can create a simple query:

The table method returns a fluent query builder instance for the given table. This would build the query below:

To get data from the select, we can is loop through the returned array of objects:

Retrieving a single row

If you just need to retrieve a single row from the database table, you may use the same (get) method.

If you don't even need an entire row, you may extract one or more values from a record using the select method.

Forcing array

If you want to force return array of objects, you can use all method

Aggregates

The query builder also provides a variety of aggregate methods such as count, max, min, avg, and sum.

Where conditions

Simple Where

You may use the where method to add where clauses to the query. The most basic call to where requires three arguments. The first argument is the name of the column. The second argument is an operator, which can be any of the database's supported operators. Finally, the third argument is the value to evaluate against the column.

For convenience, if you want to verify that a column is equal to a given value, you may pass the value directly as the second argument to the where method:

You may use a variety of other operators when writing a where clause:

OR condition

You may chain where constraints together as well as add "or" clauses to the query.

AND/OR closure

If you need to group an "or" or "and" condition within parentheses, you may pass a Closure as the first argument to the method:

This would build the query below:

BETWEEN condition

The whereBetween / whereNotBetween method verifies that a column's value is between / not between two values:

IN condition

The whereIn / whereNotIn method verifies that a given column's value is contained / not contained within the given array:

IS NULL condition

The whereNull / whereNotNull method verifies that the value of the given column is NULL / not NULL:

Raw Where

The rawWhere method can be used to inject a raw where condition into your query. This method accept an array of bindings argument.

Method aliases

Below is a table with all the methods of the where conditions and their aliases.

Method Alias
where() and()
andWhere()
orWhere() or()
whereBetween() andBetween()
andWhereBetween()
orWhereBetween() orBetween()
whereNotBetween() andNotBetween()
andWhereNotBetween()
orWhereNotBetween() orNotBetween()
whereIn() andIn()
andWhereIn()
orWhereIn() orIn()
whereNotIn() andNotIn()
andWhereNotIn()
orWhereNotIn() orNotIn()
whereNull() andNull()
andWhereNull()
whereIsNull()
andIsNull()
andWhereIsNull()
orWhereNull() orNull()
orWhereIsNull()
orIsNull()
whereNotNull() andNotNull()
andWhereNotNull()
whereIsNotNull()
andIsNotNull()
andWhereIsNotNull()
orWhereNotNull() orNotNull()
orWhereIsNotNull()
orIsNotNull()

Joins

The query builder may also be used to write simple join statements with leftJoin, rightJoin, crossJoin, innerJoin or rawJoin methods:

Insert

You can insert row/s in database with insert method.

This will return the last inserted id. The insert method also accepts the exec() method and it will return true on success or false on failure.

Update

You can update row/s with update method.

Delete

You can delete row/s with delete method.

Ordering, grouping, limit and offset

You may use the groupBy method to group the query results.

The orderBy method allows you to sort the result of the query by a given column:

You may use the limit method to limit the number of results returned from the query:

To skip a given number of results in the query, you may use the limit and offset methods:

Raw Query

Sometimes you may need to use a raw expression in a query. To create a raw expression, you may use the query method:

The values method binds a value to a parameter. Binds a value to a corresponding named placeholder in the SQL statement that was used to prepare the statement.

Pagination

Pagination means displaying all your fetched results in multiple pages instead of showing them all on one page. To change the page number use page query param in URI (http://example.com/?page=1).

We will have this result:

If you want retrieve specific fields from records you may use:

Security

Embryo PDO uses PDO parameter binding to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings.

Debugging

You may use the debug method for for to dumps the information contained by a prepared statement directly on the output.

This would build the output below:

If you want only to show query, you may print object:

This would build the output below:


All versions of embryo-pdo with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
davidecesarano/embryo-http Version dev-master
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 davidecesarano/embryo-pdo contains the following files

Loading the files please wait ....