Download the PHP package codesignificant/api-pro without Composer

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

ApiPro — Lightweight PHP REST API Framework

ApiPro is a high-performance, lightweight, production-ready PHP REST framework built on a secure, service-oriented paradigm. It is engineered with a strict Separation of Concerns architecture, native multi-device stateful sessions via Redis, deterministic page builders, and distributed high-concurrency protection tools.


Key Features


Directory Layout


1. Clean Separation of Concerns

To maximize testability and keep code state-free, ApiPro strictly separates request boundaries:

  1. The Controller parses inputs, manages HTTP headers, verifies permissions using the secure Session::Get() module, and converts web state into primitives (such as $userId).
  2. The Service acts as a pure machine. It has zero knowledge of HTTP headers, cookies, or the global web environment. It operates purely on arguments passed down by the Controller and returns a standardized DataResponse.

Implementation Example

Controller Layer (lib/controller/ProductController.php):

Service Layer (lib/service/ProductService.php):


2. Request Handling & Parameter Validation (Deprecated: Node)

ApiPro introduces the object-oriented Request class for extracting and validating input parameters.

Request Injection

Controller methods access the current HTTP request by accepting a $request parameter (which is injected automatically by the router):

Type-Safe Retrieval & Validation Rules

The $request->body, $request->params, and $request->multipart sub-properties (instances of RequestData) provide type-specific methods that cast values and handle validation:

Mandatory vs Optional Parameters:

  1. Mandatory: If the second argument ($default) is omitted (checked via argument count), the parameter is treated as required. If it is missing or fails the type validation, the request automatically halts and returns a standard 400 Bad Request validation response (DataFailed) detailing the missing key.
  2. Optional: If a default value is provided, the key is treated as optional, and the default value is returned if the parameter is missing or invalid.

Endpoint Documentation (addComment)

You can document an endpoint inside its controller method using $request->addComment("Read me description"). The static router analysis parses these comments and displays them in the interactive tester UI:

Legacy Node Class (Deprecated)

The static Node class (Node::body(), Node::params(), Node::files()) is deprecated. Existing usages are fully backward compatible but will log and trigger deprecation headers:


3. Standardized JSON Envelope Contract

All success responses returned by the framework are automatically formatted using a unified, clean three-key envelope:

If a request fails, a clean error structure is returned:


4. High-Concurrency Distributed Locks (ProLock)

Protect critical pathways (deducting balances, booking hotel rooms, checking out shopping carts) from double-spend and race conditions with native Redis-backed mutexes:


5. Multi-Device Stateful Session Security

ApiPro provides full session control with customizable maximum device limits:


6. Config-Driven Automatic Schema Sync & 3-Tier Locks

ApiPro introduces a base Repository (backed by ProRepository) class that automatically synchronizes database table schemas declared inside child constructors, managed globally or protected by a robust 3-tier lock system.

Queue-Based Schema Creation & Dependency Resolution

All table creation and alter/update tasks are collected into a schema creation queue and processed iteratively over up to 3 passes. If a table schema requires another table schema (e.g., foreign key references or dependent table structures), the queue re-attempts execution in subsequent passes. If any schema operation continues to fail after 3 attempts, the framework immediately halts and responds with an HTTP 500 DataFailed response detailing the migration error.

Key Operational Sync Modes (config.php):

Database Query Error Handling (ProSql)

Database connection failures and query execution errors in ProSql return a DataFailed response envelope with an explicit HTTP 500 status code (e.g. new DataFailed("Query failed: ...", 500)).

The 3-Tier Lock Hierarchy:

  1. Global Lock (Project Scope): Set define('DB_WRITE', 'lock'); in config.php to prevent drops or alterations on any table in the entire codebase.
  2. Repository Lock (Class Scope): Pass true or ['lock' => true] as the second argument to parent::__construct($tables, true) to lock all tables declared inside that repository class.
  3. Table Lock (Table Scope): Define 'lock' => true on an individual table configuration array to protect only that table.

If locked at any level, the engine will still auto-create the table if it's missing (to prevent app crashes), but will completely bypass any drops, recreations, or alters if the table already exists.


7. Symmetric Data Encryption Layer

ApiPro features a dedicated symmetric data encryption layer for response payloads. This encrypts the value of the "data" key in all success and failure response envelopes.

Code Examples:


8. Running and Setting Up the Project

Local Development Server

To start the built-in PHP development server, run from the project root:

Or you can use the composer script:

The server will be running on http://127.0.0.1:8000.

Setup Checklist

  1. Initialize Workspace: Run composer install to download dependencies and trigger post-install mappings.
  2. Environment Configuration: Set credentials and encryption constants in config.php:
    • SERVER_ENC (Tokens and session keys)
    • DATA_ENC (Symmetric response data keys)
    • Redis host and port config (TOKEN_DRIVER => 'redis')
    • Database sync modes (DB_WRITE => 'update' for dev, DB_WRITE => false for database-less or production mode)

9. ApiPro CLI Tool

The framework includes a CLI companion tool in the project root: api-pro.

Commands

Installation Guide

Prerequisites

Make sure your development server meets the following requirements:

Option 1: Via Composer (Recommended)

Create a brand new ApiPro project from the official skeleton:

This command downloads the framework skeleton, initializes the correct configurations, performs post-install mappings, and cleans up temporary setup documentation for a production-ready folder structure.

Option 2: Direct Git Clone

Clone the repository manually:

Post-Installation Setup

  1. Configure Environment: Update config.php in the root directory with your MySQL DB, Redis, and MAILER settings.
  2. Set up Web Server routing:
    • Apache: The preconfigured .htaccess file handles URL rewriting and routes requests to index.php out of the box. Ensure mod_rewrite is enabled.
    • Nginx: Set your server block configuration to rewrite unmatched requests:

Release Notes & Updates

Version 2.4.2 Release Notes

ApiPro v2.4.2 introduces strict typing for multiple and single file uploads, along with inline format validation.

Version 2.4.1 Release Notes

ApiPro v2.4.1 enforces explicit source targeting on all request getters and introduces the query property alias.

Version 2.4.0 Release Notes

ApiPro v2.4.0 focuses on improving request input validation, parameter type safety, and inline endpoint documentation.

Version 2.3.0 Release Notes

ApiPro v2.3.0 focuses on modularizing the debugger tools, introducing global utility logging, and stabilizing the CLI update engine.

How to Update an Installed Instance

To update your existing ApiPro project to this latest release, execute the built-in updater command from your terminal:

The updater will download the specified release, safely perform a fresh overwrite of the framework Core/ directory, and verify your updated setup while keeping your custom lib/ controllers/services and config.php files untouched.


License

This project is open-source software licensed under the MIT License.


All versions of api-pro with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-redis 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 codesignificant/api-pro contains the following files

Loading the files please wait ...