Download the PHP package nagyatka/pandabase without Composer

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

PandaBase

Installation

We recommend that use version above v0.20.0, because of significant API and performance changes.

How to use ConnectionManager

Get ConnectionManager instance

You can reach the ConnectionManager singleton instance globally via getInstance() method

Add connection to manager object

You can easily set a new database connection in Pandabase.

Add more connection to manager object

ConnectionManager is able to handle more connection at time. The connections can be distinguished via the name parameter, for example you can use "test_connection1" and "test_connection2" in the following example:

Get connection

The getConnection method returns with the default connection if you leave the name parameter empty. The default connection will be the firstly set connections.

Get connection by name

Set the default connection by name

Execute queries using ConnectionManager

How to use Connection

Connection is a PDO wrapper (all PDO function is callable) and provides a modified fetchAssoc and fetchAll methods for better usability. Although the ConnectionManager instance provides wrapper function for Connection instance's function so we recommend to use these wrapper function instead of calling them directly.

Get connection

Fetch a result row as an associative array

Returns with an array containing all of the result set rows as an associative array

Create classes based on database scheme

You can create classes based on tables of database. To achieve this, you have to only extend your classes from SimpleRecord or HistoryableRecord and register them to the specified connection.

SimpleRecord

Implement a SimpleRecord class

Assume that we have a MySQL table named as transactions and it has a primary key.

Implement Transaction class:

In next step you have to add a Table object (this is a table descriptor class) to the specified Connection instance in the following way when you initialize the connection:

And that's all! Now you can create, update and delete records from the table:

HistoryableRecord

HistoryableRecord has the same features as SimpleRecord but it also storea the previous state of a record.

Implement a HistoryableRecord class

Assume that we have a MySQL table named as transactions and the table has the following columns (all of them required):

Implement Order class:

In next step you have to add a Table object (this is a table descriptor class) to the specified Connection instance in the following way when you initialize the connection:

Now you can use HistoryableRecord as a SimpleRecord, but you can get also historical information about the instance:

Lazy attributes

Sometimes you have to store foreign keys in your table to represent connection between different objects. Without lazy attribute load you can load the objects this way:

Or if you want to provide a class method:

Instead of this, you can use LazyAttribute to implement this kind of connection on fast and easily way.

First you have to extend your table description. In our example we'd like to store an 'order_id' for a transaction record and want to reach the appropriate Order instance via 'order' key:

(We supposed that you extended the mysql table declaration too with the new 'order_id' column.)

Now you can use a Transaction instance in the following way:

####### TODO: AccessManagement

License

PandaBase is licensed under the Apache 2.0 License


All versions of pandabase with dependencies

PHP Build Version
Package Version
No informations.
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 nagyatka/pandabase contains the following files

Loading the files please wait ....