Download the PHP package jenky/hades without Composer

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

Hades

Latest Version on Packagist Github Actions Codecov Total Downloads

Dealing with errors when building an API can be a pain. Instead of manually building error responses you can simply throw an exception and the Hades will handle the response for you.

Installation

You may use Composer to install this package into your Laravel project:

Configuration

Generic Error Response Format

By default all thrown exceptions will be transformed to the following format:

The debug information only available when application is not in production environment and debug mode is on.

Example:

Any keys that aren't replaced with corresponding values will be removed from the final response.

Formatting Exception

If you would like to use different error format for your application, you should call the Hades::errorFormat() method in the boot method of your App\Providers\AppServiceProvider class:

Customizing Exception Response

Hades uses api-error internally. Please see the exception transformations to see how it works.

To add a custom transformers, you can use the config file

Alternatively, if Laravel can't inject your custom exception transformer, you may wish to register the exception transformer with the api_error.exception_transformer tag in your service provider. Typically, you should call this method from the register method of your application's App\Providers\AppServiceProvider class:

Content Negotiation

Forcing the JSON Response

By default, Laravel expects the request should contains header Accept with the MIME type application/json or custom MIME with json format such as application/vnd.myapp.v1+json in order to return JSON response. Otherwise your may get redirected to login page if the credentials are invalid or missing/passing invalid authorization token.

While this is a good design practice, sometimes you may wish to attach the header to request automatically, such as using Laravel as pure API backend. To do this, you should call the Hades::forceJsonOutput() method within the boot method of your App\Providers\AppServiceProvider.

Hades will add the header Accept: application/json to all incoming API requests. If you want to use custom MIME type, you may use the withMimeType to specify the MIME type:

Identify API Requests

In order to force the response to return JSON output, Hades needs to identify the incoming request so it doesn't add the Accept header on your normal HTML pages.

By default, all your API routes defined in routes/api.php have /api URI prefix automatically applied. Hades will inspects the incoming request URI and determines it's URI matches the /api prefix.

To customize this behavior, you may pass the closure to Hades::forceJsonOutput() to instruct Hades how to identify the incoming request:

If your application is built solely for API use, you can configure the request to always return a JSON response.

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

Contributing

Please see CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of hades with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/config Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
jenky/api-error Version ^0.2
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 jenky/hades contains the following files

Loading the files please wait ...