Download the PHP package impeck/safemysql without Composer

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

SafeMySQL

English | Русский

SafeMySQL is a PHP class designed for secure and efficient MySQL query handling.

Forked from colshrapnel/safemysql.

It stands out for several key features:

Features

SafeMySQL offers three primary features that distinguish it from standard libraries:

  1. Type-Hinted Placeholders: Unlike traditional libraries, SafeMySQL employs type-hinted placeholders for all query elements.
  2. Streamlined Usage: It eliminates the need for repetitive binding and fetching, thanks to a range of helper methods.
  3. Partial Placeholder Parsing: SafeMySQL allows placeholder parsing in any part of the query, making complex queries as easy as standard ones through the parse() method.

Getting Started

Using SafeMySQL is straightforward. Here are the key steps:

  1. Always use placeholders for dynamic data in your queries.
  2. Mark each placeholder with a data type, including:
    • ?s ("string"): For strings (including DATE, FLOAT, and DECIMAL).
    • ?i ("integer"): For integers.
    • ?n ("name"): For identifiers (table and field names).
    • ?a ("array"): For complex placeholders used with the IN() operator (substituted with a string in 'a,'b,'c' format, without parentheses).
    • ?u ("update"): For complex placeholders used with the SET operator (substituted with a string in field='value',field='value' format).
    • ?p ("parsed"): A special placeholder type for inserting pre-parsed statements without further processing to avoid double parsing.
  3. Utilize helper methods to retrieve data from queries, including:
    • query($query, $param1, $param2, ...): Returns a mysqli resource.
    • getOne($query, $param1, $param2, ...): Returns a scalar value.
    • getRow($query, $param1, $param2, ...): Returns a 1-dimensional array (a row).
    • getCol($query, $param1, $param2, ...): Returns a 1-dimensional array (a column).
    • getAll($query, $param1, $param2, ...): Returns a 2-dimensional array (an array of rows).
    • getInd($key, $query, $par1, $par2, ...): Returns an indexed 2-dimensional array (an array of rows).
    • getIndCol($key, $query, $par1, $par2, ...): Returns a 1-dimensional array (an indexed column) consisting of key => value pairs.
  4. For complex cases, rely on the parse() method.

Example Usage

Here are some examples of how to use SafeMySQL:

The standout feature of SafeMySQL is its type-hinted placeholders. This approach extends beyond simple scalar data, allowing you to include identifiers, arrays for the IN operator, and arrays for INSERT and UPDATE queries. No more struggling with binding field names or constructing complex queries manually.

For instance, consider binding a field name effortlessly:

Simplifying queries involving arrays for the IN operator:

The same convenience extends to complex queries like INSERT and UPDATE.

SafeMySQL also provides a set of helper functions, making database calls for everyday tasks quick and straightforward.


All versions of safemysql with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.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 impeck/safemysql contains the following files

Loading the files please wait ....