Eonx Packages Documentation

website·Indexed 33 days ago

https://packages.eonx.com/

A collection of PHP packages for Symfony, Laravel, and Lumen, including EasyWebhook for webhook management, EasyBugsnag for error tracking and session monitoring, EasyLogging for logging configuration, EasyRepository for Doctrine ORM integration, and other utilities like EasyAsync, EasyDecision, EasyRandom, and EasyBatch.

Tokens
35.2K
Snippets
193
Records
272
Agent score
49%

What's inside Eonx Packages

  1. Overview of easy-api-token authentication decoding

    The easy-api-token package extracts authentication tokens from HTTP requests and converts them into a common ApiToken interface. This allows applications to use tokens as parameters regardless of the authentication strategy.

    Supported strategies include:

    • Basic Auth
    • API keys
    • JWTs (specifically Amazon Cognito, Auth0, and Firebase)

    The package also includes a "chain" decoder, which allows a single API endpoint to support multiple authentication strategies simultaneously.

  2. Overview of EasyWebhook core components

    EasyWebhook uses a middleware-based architecture to handle the lifecycle of a webhook. The primary components are:

    • Webhook class: Defines the configuration for a webhook, such as the target URL.
    • WebhookClient class: Triggers the processing of the middleware stack for a specific webhook.
    • Middleware Stack: The core engine that handles specific tasks including sending HTTP requests, capturing responses via the WebhookResult class, managing retries, persisting data to stores (e.g., Null, Array, or Doctrine DBAL), and dispatching success/failure events.
  3. Overview of EasyActivity activity logging

    The EasyActivity package stores activity log entries for actions performed on subjects. By default, these entries are stored as database records in the easy_activity_logs table. Developers can use EonX\EasyActivity\Bridge\Doctrine\DoctrineDbalStatementsProvider to create the required table or define their own database entity/model based on this table.
  4. Overview of EasyActivity object change logging

    The EasyActivity package is used to log changes to objects within an application. It captures the state of an object before and after a change, as well as details about the actor who initiated the change. The package automatically creates activity log entries for every action performed on configured subjects.
  5. Overview of EasyErrorHandler capabilities

    The EasyErrorHandler package is used to build informative HTTP responses and reports when exceptions occur in PHP applications. It provides a standardized way to:

    • Define a common structure for exceptions.
    • Generate consistent error responses for unhandled exceptions.
    • Report exceptions to the application's main logging channel or custom destinations.
    • Automatically notify Bugsnag based on exception log levels (when used with the easy-bugsnag package).
  6. Overview of EasyUtils Helper classes

    EasyUtils provides a set of helper classes to simplify common development tasks:

    • CollectorHelper: Facilitates the implementation of the Collector Design Pattern, specifically for managing collections of tagged services.
    • Math: Provides methods for number manipulation.
  7. Overview of easy-request-id for PHP

    The easy-request-id package allows PHP projects to resolve and share IDs across multiple applications in a microservices infrastructure. It distinguishes between two types of IDs:

    • request_id: An ID specific to the request within a single project.
    • correlation_id: A shared ID used across all projects involved in the same initial request.

    It integrates with other EonX packages to automatically include these IDs in Bugsnag notifications (EasyBugsnag), error responses (EasyErrorHandler), logs (EasyLogging), and webhooks (EasyWebhook).

  8. Integrate EasyErrorHandler with a framework

    Once the EasyErrorHandler package is installed and enabled, it integrates seamlessly with your framework. All exceptions handled by the framework will automatically use EasyErrorHandler to generate error responses and reports.
  9. Understand the EasyWebhook middleware stack

    EasyWebhook uses a middleware stack processed every time a webhook is sent. The process flows down the stack to the point where the HTTP request is sent, and then flows back up the stack. Middleware are services that implement EonX\EasyWebhook\Interfaces\MiddlewareInterface.

    Priority and Ordering:

    • Middleware are ordered by priority: lower priority values are placed earlier in the stack.
    • Custom middleware can have priorities between -5000 and 5000 (default is 0).
    • Core middleware is strategically placed to ensure critical operations (like locking the Webhook object or sending the HTTP request) happen at the correct time.
  10. Integrate Bugsnag into a PHP application using EasyBugsnag

    EasyBugsnag provides a simplified implementation of Bugsnag for PHP frameworks or plain PHP applications. The primary requirement for setup is providing the Bugsnag Integration API Key. Once installed, the Bugsnag client can be injected into your application services to report errors and exceptions.
    // src/Exception/Handler.php
    
    namespace App
    
    use Bugsnag\Client;
    
    final class ExceptionHandler
    {
        /**
         * @var \Bugsnag\Client
         */
        private $client;
    
        public function __construct(Client $client)
        {
            $this->client = $client;
        }
    
        public function report(\Throwable $throwable): void
        {
            // Notify Bugsnag of your throwable
            $this->client->notifyException($throwable);
        }
    }
  11. Initialize a Bugsnag client using the EasyBugsnag Client Factory

    The EasyBugsnag package provides a client factory that implements EonX\EasyBugsnag\Interfaces\ClientFactoryInterface. This factory simplifies the setup process by creating a Bugsnag client instance using only the Bugsnag Integration API key, removing the need for manual boilerplate configuration.
  12. Understand how EonX EasyPagination resolvers work

    EonX EasyPagination uses 'resolvers' to extract pagination data from a request based on a provided configuration. To ensure interoperability, all resolvers require a PSR7 ServerRequestInterface object.