Download the PHP package andro-adel/microservice-package without Composer
On this page you can find all versions of the php package andro-adel/microservice-package. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andro-adel/microservice-package
More information about andro-adel/microservice-package
Files in andro-adel/microservice-package
Package microservice-package
Short Description initialize packages required for logging , messaging with rabbitmq , redis caching
License MIT
Informations about the package microservice-package
About Package
This is a laravel package to be used with each microservice to setup main packages and configurations.
Packages that will be installed
- itspire/monolog-loki ^2.1.
- monolog/monolog ^3.5.
- open-telemetry/opentelemetry-logger-monolog ^1.0.
- predis/predis ^2.2.
- vladimir-yuldashev/laravel-queue-rabbitmq ^13.3 - notion-documentation.
- knuckleswtf/scribe ^4.29.
- maatwebsite/excel ^3.1.
- barryvdh/laravel-snappy ^1.0.
- h4cc/wkhtmltopdf-amd64 ^0.12.x.
- pestphp/pest ^2.33.
- phpunit/phpunit ^10.5.
Installation
You can install the package via composer:
Vendor Publish
Publish all the files
Publish the config files individually
Publish the lang files individually
Publish the tests files individually
Configuration
This package has the configuration files in the config folder upon installation, extending the project configuration from ddconfig. and this files are:
- ddconfig.php - This file will be used to configure the logging.channels and database.redis that will be used in the microservice.
- excel.php - This file will be used to configure the exporting and importing of excel files.
- scribe.php - This file will be used to configure the API documentation.
- services-communication.php - This file will be used to configure the services communication.
- snappy.php - This file will be used to configure the downloading and streaming of PDF files.
Usage
ApiResponses
This functions will be used by the microservice to return the response in a standard way.
Success Response
This function will be used to return a success response with the data, reason, message, additionData, status.
example:
Success No Content Response
This function will be used to return a success response with no content.
example:
Not Modified Response
This function will be used to return a not modified response.
example:
Bad Request Response
This function will be used to return a bad request response.
example:
Unauthorized Response
This function will be used to return an unauthorized response.
example:
Unauthenticated Response
This function will be used to return an unauthenticated response.
example:
Not Found Response
This function will be used to return a not found response.
example:
Conflict Response
This function will be used to return a conflict response.
example:
Not Valid Response
This function will be used to return a not valid response.
example:
Server Error Response
This function will be used to return a server error response.
example:
Success Pagination Response
This function will be used to return a success pagination response.
example:
Success Show Pagination Response
This function will be used to return a success show pagination response.
example:
Success Show Paginated Data Response
This function will be used to return a success show paginated data response.
example:
Created Successfully Response
This function will be used to return a created successfully response.
example:
Caching
This functions will be used by the microservice to handle caching data.
Creating Object From Caching class
- Creating Object From Caching class
and you can change the default connection on object creation by passing the connection name to the constructor.
or you can change the default connection after object creation by using the setConnection function.
- Injecting Caching class
and you can change the default connection after object creation by using the setConnection function.
Caching Functions
-
Set Cache
-
Set Cache With Options
-
Set Multiple Cache
-
Get Cache
-
Rename Key
-
Delete Cache
-
Get Key Type
-
Set Expire
-
Set Expire With Options
-
Check If Cache Exists
-
Key Searching
-
Get All Keys
-
Run Set of commands together
- Run Command
Filters
This functions will be used by the microservice to handle filtering data.
Creating Object From FilterManager class
- Creating Object From FilterManager class
filters data is the data that will be used to apply filters.
the default filters data will be set to the request data with key filter
, and you can set filters data on object creation by passing the filters data to the constructor.
or you can set the filters data after object creation by using the setFiltersData function.
- Injecting FilterManager class
and you can set the filters data after object creation by using the setFiltersData function.
Build Filters
- Add Where Filter
by default the operator will be set to =
, you can pass the operator to the function to apply the operator to the filter.
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the column name, you can pass difference key to the function to apply the value to the filter.
- Add Where In Filter
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the column name, you can pass difference key to the function to apply the value to the filter.
- Add Where Not In Filter
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the column name, you can pass difference key to the function to apply the value to the filter.
- Add Where Has Filter [NOTE: you can't use this function with collection or array data.]
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the relation name, you can pass difference key to the function to apply the value to the filter.
- Add Where Has Morph Filter [NOTE: you can't use this function with collection or array data.]
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the relation name, you can pass difference key to the function to apply the value to the filter.
- Add Has Filter [NOTE: you can't use this function with collection or array data.]
by default the operator will be set to >=
, you can pass the operator to the function to apply the operator to the filter.
by default, when applying the filters the value for this where filter will be taken from the filters data with the same key as the column name, you can pass difference key to the function to apply the value to the filter.
-
Add Where Between Filter there are four ways to use this function.
-
First way
-
Second way
-
Third way
-
Forth way if you have a different logic to apply the where between filter you can pass a callback to the function to apply the logic to the filter.
-
Add Where Not Between Filter there are four ways to use this function.
-
First way
-
Second way
-
Third way
- Forth way
if you have a different logic to apply the where between filter you can pass a callback to the function to apply the logic to the filter.
-
- Add Where Function Filter
$filterKey
is the key that will be used to check if this filter will be applied or not.
- Add Multiple Where Filter
by default the operator will be set to =
, you can pass the operator to the function to apply the operator to the filter.
-
Add Multiple Where In Filter
-
Add Multiple Where Not In Filter
-
Add Multiple Where Has Filter [NOTE: you can't use this function with collection or array data.]
- Add Multiple Has Filter
by default the operator will be set to >=
, you can pass the operator to the function to apply the operator to the filter.
-
Add Multiple Where Between Filter
- Add Multiple Where Not Between Filter
Applying Filters
Now you can simply call function applyFilters
from $filterManager
object.
And your data will be filtered.
Example
Logging
Logging Types
- emergency
- alert
- critical
- error
- warning
- notice
- info
- debug
Functions
For each type there are an static function to handle it, all function have two parameters string $message
and array $context = []
.
Form Request
extends the DD\MicroserviceCore\Abstracts\ApiFormRequest
abstract class.
All versions of microservice-package with dependencies
monolog/monolog Version ^3.5
open-telemetry/opentelemetry-logger-monolog Version ^1.0
predis/predis Version ^2.2
vladimir-yuldashev/laravel-queue-rabbitmq Version ^13.3
knuckleswtf/scribe Version ^4.29
maatwebsite/excel Version ^3.1
barryvdh/laravel-snappy Version ^1.0
h4cc/wkhtmltopdf-amd64 Version 0.12.x
pestphp/pest Version ^2.34