Download the PHP package uthayakumar-dinesh/statusify without Composer
On this page you can find all versions of the php package uthayakumar-dinesh/statusify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uthayakumar-dinesh/statusify
More information about uthayakumar-dinesh/statusify
Files in uthayakumar-dinesh/statusify
Package statusify
Short Description HTTP status codes as constants with helper function for PHP
License MIT
Informations about the package statusify
uthayakumar-dinesh/statusify
A lightweight PHP library that provides HTTP status codes as class constants with utility methods for reverse lookup operations. Perfect for building consistent and type-safe web applications and APIs.
Features
✨ HTTP Status Code Constants: All common HTTP status codes available as class constants 🔍 Reverse Lookup: Static method to get status name from numeric code 🎯 Zero Dependencies: Lightweight package with no external dependencies 🚀 PSR-4 Autoloading: Follows PHP standards for easy integration 📝 IDE Friendly: Full IntelliSense support with class constants ⚡ PHP 7.4+ Compatible with modern PHP versions
Installation
Install via Composer:
Usage
Basic Usage
Laravel Example
Symfony Example
API Response Helper Class
Custom Exception Handler
API Reference
Class Constants
The Statusify class provides HTTP status codes as public constants:
Static Methods
getStatusName(int $code): string
Returns the constant name for a given HTTP status code.
Parameters:
$code(int): The numeric HTTP status code
Returns:
string: The constant name corresponding to the status code, or"UNKNOWN_STATUS"if not found
Example:
Available HTTP Status Codes
1xx Informational
| Code | Constant | Description |
|---|---|---|
| 100 | CONTINUE |
Continue |
| 101 | SWITCHING_PROTOCOLS |
Switching Protocols |
2xx Success
| Code | Constant | Description |
|---|---|---|
| 200 | OK |
OK |
| 201 | CREATED |
Created |
| 202 | ACCEPTED |
Accepted |
| 204 | NO_CONTENT |
No Content |
3xx Redirection
| Code | Constant | Description |
|---|---|---|
| 301 | MOVED_PERMANENTLY |
Moved Permanently |
| 302 | FOUND |
Found |
| 304 | NOT_MODIFIED |
Not Modified |
4xx Client Errors
| Code | Constant | Description |
|---|---|---|
| 400 | BAD_REQUEST |
Bad Request |
| 401 | UNAUTHORIZED |
Unauthorized |
| 403 | FORBIDDEN |
Forbidden |
| 404 | NOT_FOUND |
Not Found |
| 405 | METHOD_NOT_ALLOWED |
Method Not Allowed |
5xx Server Errors
| Code | Constant | Description |
|---|---|---|
| 500 | INTERNAL_SERVER_ERROR |
Internal Server Error |
| 501 | NOT_IMPLEMENTED |
Not Implemented |
| 502 | BAD_GATEWAY |
Bad Gateway |
| 503 | SERVICE_UNAVAILABLE |
Service Unavailable |
Requirements
- PHP 7.4 or higher
- Composer for installation
Framework Compatibility
This package works seamlessly with:
- ✅ Laravel (5.5+)
- ✅ Symfony (4.0+)
- ✅ CodeIgniter (4.0+)
- ✅ CakePHP (4.0+)
- ✅ Slim Framework (4.0+)
- ✅ Laminas (formerly Zend)
- ✅ Pure PHP projects
Testing
Contributing
We welcome contributions! Please follow these steps:
-
Fork the repository
-
Install dependencies
-
Create a feature branch
-
Make your changes
- Follow PSR-12 coding standards
- Add tests for any new functionality
- Ensure all tests pass:
composer test
-
Commit your changes
- Push to your fork and create a Pull Request
Development Setup
Code Standards
- Follow PSR-12 coding standards
- Use meaningful variable and method names
- Add PHPDoc blocks for all public methods
- Write tests for new functionality
- Maintain backward compatibility
Issues and Support
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Issues
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Repository
- GitHub: https://github.com/uthayakumar-dinesh/statusify-php
- Packagist: uthayakumar-dinesh/statusify
Made with ❤️ by Uthayakumar Dinesh