Download the PHP package maatify/api-response without Composer

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

๐Ÿ“ฆ Maatify API Response

Maatify.dev

Current version PHP Version Support Monthly Downloads Total Downloads Stars Tests


Maatify API Response is a lightweight, PSR-7 compatible, Slim-friendly structured JSON response library for clean and consistent API responses. Built with production logging in mind via maatify/slim-logger. It is part of the modular Maatify.dev ecosystem.


๐Ÿš€ Features


๐Ÿ›  Installation

Requires PHP 8.1+
Uses maatify/slim-logger under the hood for logging (installed automatically)


๐Ÿ“ฆ Usage in Slim


๐Ÿ’ก Usage in Pure PHP (no framework)

Use the built-in JsonResponseEmitter class to send PSR-7 responses directly in native PHP.


๐Ÿ” Output


โœจ Example Slim Response


โœ… Supported Methods

Method Description
missing() Field missing from input
incorrect() Incorrect format or value
invalid() Invalid input
notExist() Value doesn't exist (e.g. user ID)
success() Standard success output
dbError() Internal DB/system error
tooManyAttempts() Rate limit exceeded

๐Ÿ“Š HTTP Status Code Reference

Method Status
missing() 400
incorrect() 400
invalid() 400
notExist() 400
success() 200
dbError() 500
tooManyAttempts() 429

๐Ÿ” Secure Logging

Enable structured logging in production via maatify/slim-logger

1. Enable in your .env

2. Sample Logged Output

Log file: logs/api/response.log
Log level: Info


๐Ÿ“‚ Directory Structure


๐Ÿงฉ Extend It

Want custom codes or more logic?


๐Ÿงช Testing

โœ… Run Tests

โœ… Run One Test

โœ… CI (GitHub Actions)

Tested on PHP 8.2, 8.3, and 8.4 using run-tests.yml


๐Ÿ†š Slim vs Pure PHP Comparison

Feature Slim Pure PHP
Routing $app->post(... Native index.php or custom
JSON Response return Json::success(...) $response = Json::success(...)
Headers/Status Handled by Slim You manually set headers + status
Logging Via maatify/slim-logger โœ… Works the same

๐Ÿ“„ License

Maatify.dev


๐Ÿ™‹โ€โ™‚๏ธ Questions or Feedback?


All versions of api-response with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
psr/http-message Version ^1.0
maatify/slim-logger Version ^1.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 maatify/api-response contains the following files

Loading the files please wait ....