Download the PHP package nette/database without Composer

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

Nette Database

Downloads this Month Tests Latest Stable Version License

Introduction

Nette provides a powerful layer for accessing your database easily.

The Nette Database Core is a wrapper around the PDO and provides core functionality.

The Nette Database Explorer layer helps you to fetch database data more easily and in a more optimized way.

Support Me

Do you like Nette Database? Are you looking forward to the new features?

Buy me a coffee

Thank you!

Installation

The recommended way to install is via Composer:

It requires PHP version 8.1 and supports PHP up to 8.3.

Usage

This is just a piece of documentation. Please see our website.

Database Core

To create a new database connection just create a new instance of Nette\Database\Connection class:

Connection allows you to easily query your database by calling query method:

Database Explorer

Nette Database Explorer layer helps you to fetch database data more easily and in a more optimized way. The primary attitude is to fetch data only from one table and fetch them at once. The data are fetched into ActiveRow instances. Data from other tables connected by relationships are delivered by another queries - this is maintained by Database Explorer layer itself.

Let's take a look at common use-case. You need to fetch books and their authors. It is common 1:N relationship. The often used implementation fetches data by one SQL query with table joins. The second possibility is to fetch data separately, run one query for getting books and then get an author for each book by another query (e.g. in your foreach cycle). This could be easily optimized to run only two queries, one for books, and another for the needed authors - and this is just the way how Nette Database Explorer does it.

Selecting data starts with the table, just call $explorer->table() on the Nette\Database\Explorer object. The easiest way to get it is described here, but if we use Nette Database Explorer alone, it can be manually created.

We can simply iterate over the selection and pass through all the books. The rows are fetched as ActiveRow instances; you can read row data from their properties.

Getting just one specific row is done by get() method, which directly returns an ActiveRow instance.

Working with relationships

You will be pleased how efficiently the database layer works. The example above performs constant number of queries, see following 4 queries:

If you use caching (defaults on), no columns will be queried unnecessarily. After the first query, cache will store the used column names and Nette Database Explorer will run queries only with the needed columns:

Continue….


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version 8.1 - 8.3
ext-pdo Version *
nette/caching Version ^3.2
nette/utils Version ^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 nette/database contains the following files

Loading the files please wait ....