Download the PHP package mzeahmed/wp-toolkit without Composer

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

WP ToolKit

WP ToolKit is a PHP library that simplifies WordPress development by providing reusable classes to handle common operations :

Installation

Then include Composer's autoloader in your project:

Features

  1. AJAX Requests
  2. Database Operations
  3. User Activity Monitoring
  4. Data Sanitization 5HTTP Client

Ajax Requests

The Ajax utility class simplifies working with AJAX in WordPress by providing methods for registering AJAX actions, validating requests, and sending JSON responses.

Features

Usage

1. Register an AJAX Action

2. Send JSON Responses

Use the sendJsonSuccess and sendJsonError methods to send standardized JSON responses:

3. Nonce Validation

Verify nonces to ensure that AJAX requests are secure:

Need to define theses constants in the application: AJAX_SECURITY_NONCE_ACTION and AJAX_SECURITY_NONCE.

And use wp_localize_script to pass the nonce to the client side.

In the client side, you can use the nonce like this:

Database Operations

Usage

1. Implement a Repository

Create a repository class that extends the AbstractRepository class. For example:

2. Use the Repository

In your WordPress plugin or theme:

3. Bulk Operations

Perform bulk inserts, updates, or deletes:

4. Transactions

Manage transactions to ensure data consistency:

User Activity Monitoring

The UserActivityMonitor class helps track user activity and determine online/offline status.

Features

Usage

1. Update User Activity

2. Check Online Status

3. Retrieve Online Users

4. Identify Recently Offline Users

Data Sanitization

The Sanitizer class provides static methods to clean user input and ensure data safety in WordPress environments.

Features

Supported Rules

Rule Description
text Uses sanitize_text_field()
email Uses sanitize_email()
url Uses esc_url_raw()
textarea Uses sanitize_textarea_field()

Usage

1. Sanitize a single value or array

2. Recursively sanitize text values in nested arrays

3. Apply custom sanitization rules

HTTP Client

The HttpClient class simplifies making HTTP requests in WordPress using wp_remote_* functions. It supports GET, POST, PUT, DELETE (and PATCH) and automatically decodes JSON responses.

Features

Usage

1. Initialize the client

2. Make a GET request

3. Make a POST request

4. Use safe mode (rejects unsafe URLs)

📖 API Reference

MzeAhmed\WpToolKit\Http\HttpClient

Method Description Return Type
get() Perform an HTTP GET request array|\WP_Error
post() Perform an HTTP POST request array|\WP_Error
put() Perform an HTTP PUT request array|\WP_Error
delete() Perform an HTTP DELETE request array|\WP_Error

Automatically decodes the JSON response body with json_decode(..., JSON_THROW_ON_ERROR).


All versions of wp-toolkit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 mzeahmed/wp-toolkit contains the following files

Loading the files please wait ...