Download the PHP package peak/database without Composer

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

Peak/Database

The purposes of this package are:

Installation

 composer require peak/database

Laravel Database Usage

That's it! Check out Laravel Query Builder for more info on how to make queries.

Database Migration Usage

For database migrations, create a file at the root of your project name . This file should return an array of Phinx configuration.

This phinx.php above will allow the usage of Laravel Database directly in your migrations with the help of LaravelPhinxMigration:

Generic tools

The purpose of generic tools is to help you express a query without being attached to a particular database framework or any database at all.

It is important to note that those generic tools doesn't to do anything by themselves. They serve mainly as "boundary" interfaces between a domain or use case and your actual real database or storage implementation. In your final implementation, you will need builder/helper to translate generic expression to your actual database framework/orm.

Example of creating generic query "where" filters and generic query "pagination"

Pass the $queryFilters and $queryPagination to a use case. This will help to create a boundary between use cases and repositories because the use case doesn't have to know the details of your implementation (database framework/orm, etc)

And finally, we use LaravelGenericHelper in our repository implementation to transform generic QueryFiltersInterface to actual laravel query builder "where" expressions;

We could simply use laravel query builder directly in our use case but this could also tie the code to much to specific database library (here laravel database). By using generic query filters and pagination, it becomes really easy to tests repository and use cases without a real database connection.

Important security information on pagination and filters with Laravel Database

From Laravel Database docs:

The Laravel query builder uses PDO parameter binding to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings. But:

"PDO does not support binding column names. Therefore, you should never allow user input to dictate the column names referenced by your queries, including "order by" columns, etc. If you must allow the user to select certain columns to query against, always validate the column names against a white-list of allowed columns."

If you let your user choose the column names, you should create a class that extends AbstractRestrictedQueryPagination to protected from unwanted column names.

The same can be applied to query filters columns and operators with AbstractRestrictedQueryFilters:


All versions of database with dependencies

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

Loading the files please wait ....