Download the PHP package oltrematica/laravel-parking-hub without Composer
On this page you can find all versions of the php package oltrematica/laravel-parking-hub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oltrematica/laravel-parking-hub
More information about oltrematica/laravel-parking-hub
Files in oltrematica/laravel-parking-hub
Package laravel-parking-hub
Short Description Laravel Parking Hub package provides a standardized interface for interacting with various parking service APIs within a Laravel application. It defines Data Transfer Objects (DTOs) to ensure consistent data structures for parking validation responses, including status, validity, and expiration details.
License MIT
Informations about the package laravel-parking-hub
Laravel ParkingHub
laravel-parking-hub is a Laravel package designed to create a unified and consistent way to interact with different
parking service APIs (e.g., Parkeon, My Cicero). It aims to standardize the input and output of parking validation
requests, making it easier to integrate and manage multiple parking providers.
Key features:
- Standardized Data Transfer Objects (DTOs): Defines DTOs for representing standard responses from parking service APIs, ensuring consistency across different providers.
- Unified Interface: Provides a common interface for executing parking validation requests (e.g., checking license plates) across different services.
- Response Standardization: Standardizes the response format, including status (success/error), parking validity, and expiration details.
- Easy Integration: Simplifies the integration of new parking service providers by providing a clear structure for data mapping and response handling.
Prerequisites
- Laravel v10, v11 and v12
- PHP 8.3 or higher
Installation
Usage Guide
Configuration
-
Publish the configuration file: To customize the default configuration, publish the
parking-hub.phpconfig file using the following Artisan command:This will create a
config/parking-hub.phpfile in your application's config directory. -
Configure Your Drivers: Open the
config/parking-hub.phpfile. Here you can define and configure your parking drivers.-
Default Driver: Set the
default_driveroption to specify the driver to be used when no driver is explicitly chosen. - Driver Settings: Under the
driversarray, configure each provider. Each driver configuration must include aclasskey, which specifies the class that implements theOltrematica\\ParkingHub\\Contracts\\ParkingValidatorinterface. You will also add provider-specific settings like API keys, endpoints, etc.
Ensure you have the necessary environment variables (e.g.,
EASYPARK_USERNAME,MYCICERO_PASSWORD) set in your.envfile. -
Basic Usage
You can interact with the parking drivers through the ParkingHub facade or by resolving the manager from the service container.
Using the Facade
Resolving from the Container
Understanding the Response
The checkPlate method returns a Oltrematica\ParkingHub\DTOs\ParkingValidationResponseData object. This DTO contains the following properties:
responseStatus: An enum (Oltrematica\ParkingHub\Enums\ProviderInteractionStatus) indicating the outcome of the interaction with the provider (e.g.,SUCCESS,ERROR_PROVIDER_UNREACHABLE,ERROR_INVALID_CREDENTIALS).plate: The license plate number checked.requestTimestamp: ACarbonInterfaceobject representing when the request was initiated.verificationTimestamp: ACarbonInterfaceobject representing the date and time for which parking validity was checked.isValid: A boolean indicating if the parking is valid for the givenverificationTimestamp.parkingEndTime: ACarbonInterfaceobject indicating when the parking expires, ornullif not applicable or unknown.purchasedParkings: An array ofOltrematica\ParkingHub\DTOs\PurchasedParkingDataobjects, providing details of active parking sessions if available from the provider. EachPurchasedParkingDataobject hasstartDateTimeandendDateTime.
Adding a New Driver
To add support for a new parking service provider:
-
Create a Validator Class: Implement the
Oltrematica\ParkingHub\Contracts\ParkingValidatorinterface. This class will handle the interaction with the provider's API. ThecheckPlatemethod should:- Accept the license plate number and verification date/time as parameters.
- Handle API response (success, errors, authentication issues).
- Map the provider's response to the fields of
ParkingValidationResponseData.
Example (replace with actual API interaction and mapping logic):
-
Configure the New Driver: Add its configuration to the
driversarray inconfig/parking-hub.php: - Use the New Driver:
Translations
This package includes translations for messages. To publish the translation files to your application's lang/vendor directory, use:
You can then customize the translations in lang/vendor/oltrematica-parking-hub/{locale}.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see GitHub repository.
Security Vulnerabilities
If you discover a security vulnerability within this package, please send an e-mail to security policy on GitHub.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-parking-hub with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
spatie/laravel-data Version ^4.15