Download the PHP package retamayo/absl without Composer

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

Absl - PHP Database Abstraction Library

The docs are live at https://absl-docs.vercel.app.

Absl (PHP Database Abstraction Library) is a lightweight and flexible library designed to simplify database operations in PHP applications. It provides a convenient interface for interacting with various database systems using the PHP Data Objects (PDO) extension.

Table of Contents

  1. Installation
  2. Connecting to a Database
  3. Defining Tables
  4. Working with Tables
  5. Retrieving Data
  6. Data Manipulation
  7. Authentication
  8. Data Validation
  9. Data Sanitization
  10. Conclusion

Installation

To use Absl in your PHP project, you can install it via Composer, which is a dependency management tool for PHP. Follow the steps below to install Absl using Composer:

  1. Ensure you have Composer installed on your system. If you don't have Composer installed, you can download and install it by following the instructions on the official Composer website: https://getcomposer.org/download/
  2. Once Composer is installed, navigate to your project directory in the command-line interface.
  3. Run the following command in your project directory to install Absl and its dependencies:

Composer will download the Absl library and its required dependencies and set up the autoloading for you. After the installation is complete, you can include the Composer autoloader in your PHP files to start using Absl:

Make sure to adjust the path to the autoload.php file based on your project structure. That's it! You have successfully installed Absl in your PHP project using Composer. You can now start using Absl's features and methods by referencing the library in your code.

Connecting to a Database

Before you can start using Absl, you need to establish a connection to your database. Absl uses the PDO extension, which supports a wide range of database systems such as MySQL, PostgreSQL, SQLite, and more.

To connect to a database, create a new PDO object and pass it to the Absl constructor:

Make sure to replace the placeholders ($host, $dbName, $username, $password) with your actual database credentials.

Defining Tables

Absl allows you to define tables by specifying the table name, primary key, and column details. This step is essential to inform Absl about the structure of your database tables.

To define a table, use the defineTable() method:

Repeat the defineTable() method for each table in your database.

Working with Tables

To perform database operations on a specific table, you need to select the table first using the useTable() method:

Once a table is selected, Absl will use the defined table structure for subsequent operations.

Retrieving Data

Absl provides several methods to retrieve data from the selected table:

To fetch all records from the table:

You can also specify which columns to fetch:

To fetch a single record based on a unique column:

To fetch all records from the table in JSON format:

To fetch a single record based on a unique column in JSON format:

Data Manipulation

Absl simplifies data manipulation operations such as creating new records, updating existing records, and deleting records.

To create a new record:

Note: When creating a new record with a password make sure to hash it and use password_hash() method and use PASSWORD_DEFAULT as the hashing algorithm, otherwise the authentication() method might not work as expected.

To update an existing record:

To delete a record:

Note : The create, update, and delete methods returns true or false depending on the status of the operation.

Authentication Absl provides an authenticate() method to validate user credentials stored in the database. You can use this method to implement user authentication functionality in your PHP application.

Make sure to store passwords securely by using techniques like hashing and salting.

Note: When passing credentials array to the authenticate function make sure to put the password index last.

Data Validation

Absl includes a checkDuplicate() method to validate the uniqueness of values in a specified column. This can be helpful for ensuring data integrity and preventing duplicate entries in your database.

Data Sanitization

Absl automatically sanitizes input values and prevent common security vulnerabilities such as SQL injection and cross-site scripting (XSS).

Conclusion

This documentation provides a basic overview of how to use Absl, a PHP database abstraction library, to simplify database operations in your PHP applications. You can explore the library further to discover additional features and advanced usage scenarios.


All versions of absl with dependencies

PHP Build Version
Package Version
Requires php Version 7.4.33|^8.0
ext-mbstring Version *
ext-iconv Version *
ext-pdo Version *
ext-json Version *
ext-curl Version *
ext-simplexml Version *
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 retamayo/absl contains the following files

Loading the files please wait ....