Download the PHP package clancats/hydrahon without Composer

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

Hydrahon

Hydrahon is a standalone database / SQL query builder written in PHP. It was built to enhance existing frameworks, libraries and applications that handle the database connection on their own. It does not come with a PDO or mysqli wrapper. The naming is heavily inspired by Eloquent and the Kohana Framework Database component.

What does that mean "Standalone query builder"?

Hydrahon only generates a query string and an array of parameters. On its own, it is not able to execute a query.

Build Status Packagist Packagist GitHub release

Status

Installation

Hydrahon follows PSR-4 autoloading and can be installed using composer:

Documentation 💡

The full documentation can be found on clancats.io

Quick Start (MySQL) ⚡️

Hydrahon is designed to be a pretty generic query builder. So for this quick start, we stick with SQL.

Create a builder

Again this library is not built as a full database abstraction or ORM, it is only and will always be only a query builder. This means we need to implement the database connection and fetching by ourselves. The Hydrahon constructor therefore requires you to provide a callback function that does this, and returns the results.

In this example, we are going to use PDO

And we are ready and set. The variable $h contains now a MySQL query builder.

Setup a simple table

To continue with our examples, we need to create a simple MySQL table.

Inserting

Currently, we do not have any data, to fix this let's go and insert some.

Will execute the following query:

As you can see Hydrahon automatically escapes the parameters.

However, because we are humans that get confused when there are hundreds of thousands of questions marks, I will continue to always display the runnable query:

Updating

Ah snap, time runs so fast, "Ray" is actually already 26.

Generating:

Currently, you might think: "Well isn't it much simpler to just write the SQL query? I mean the PHP code is even longer...".

You have to understand that these are some very very basic examples the Hydrahon query builder starts to shine when things get more complex. However, a "Quick Start" is just the wrong place for complicated stuff, so throw an eye on the full documentation.

Deleting

Dammit John, I hate you...

Generating:

Selecting

And finally, fetch the data.

Generating:

Result:

Notice that we use ->get() to actually fetch data, while we used ->execute() for our previous queries (updates, inserts and deletes). See the full documentation for more information about the Hydrahon runners methods.

Where conditions

For the next few examples, lets assume a larger dataset so that the queries make sense.

Chaining where conditions:

Notice how omitting the operator in the first condition ->where('age', 21) makes Hydrahon default to =.

By default all where conditions are defined with the and operator.

Different where operators:

Please check the relevant section in the full documentation for more where-functions, like

Where scopes

Allowing you to group conditions:

Joins

Joining tables:

Grouping

Grouping data:

Ordering

Ordering data:

Limiting data

Limit and offset:

Small reminder this is the quick start, check out the full docs.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of hydrahon with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 clancats/hydrahon contains the following files

Loading the files please wait ....