Download the PHP package ipaas/gapp-laravel without Composer
On this page you can find all versions of the php package ipaas/gapp-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ipaas/gapp-laravel
More information about ipaas/gapp-laravel
Files in ipaas/gapp-laravel
Package gapp-laravel
Short Description IPaaS package for laravel provides php support for google app-engine logging and handling
License CC-BY-NC-ND-4.0
Homepage https://5andhalf.com/
Informations about the package gapp-laravel
iPaaS package for Laravel
This package includes
- Driver for Google stack logging
- Exception handler for Google error reporting
- Log-info (
iLog
) helper- To collect info on runtime through laravel service container interface
- To render collected info and attach to each log context
- Middleware
- To authenticate request
- To capture initial request for logger
- Request
- To provide additional methods with request
- Exceptions
- To report exception with Log-info context
- To render exception according to iPaaS set standards
- Response
- To all context information with response
- To render error and response according to iPaaS set standards
- Other helpers
- Converter
- [more coming soon]
Setup
i. Add Package
Run composer update after adding composer package
OR; by running
Make sure that the
ENV: GAPP_SECURE is set to true
; and
ENV: LOG_CHANNEL on gcloud environment is set to stack-driver
;
ii. Migration and Artisan Command
If you are using the version 2.0 or later, you will have access to the migration and artisan command:
command will push the middleware to the application, and furthermore using GAPP_SECURE
set to true
, the security will be applied.
command will create a new partner_apps
table in your application, which will be used to verify the X-Api-Key
when passing the middleware partner
.
command will create a new row in your new partner_apps
table with a provider name as optional argument.
API Documentation
Log-info (ilog)
Helper to add context information to all log entries.
Once context is added to ilog it will append to all future logs entries ilog refresh with each request and; have same life cycle as of request()
ilog()
is a helper method returning singleton class Ipaas\Gapp\Logger\Client.php
To add context info just call ilog()
and chain any method available.
Following methods are available:
Method | Usage |
---|---|
setClientId (string) |
set client id/name |
setClientKey (string) |
set client key/token |
setRequestId (string) |
set request id/token |
setType (string) |
type of request |
prop ((string)value, (string)name) |
any custom key and value |
setDate ((string⎮Carbon)value, (string)name) |
any custom date key and value |
setDateFrom (string⎮Carbon) |
sync/request date from |
setDateTo (string⎮Carbon) |
sync/request date to |
setUuid (string⎮null) |
universal unique identifier |
toArray() |
get all info as array |
iLog([data-set])
can be use to re-init log data. _can be use to pass log-info to queue jobs_
Example Following example will write log in GCloud Logging with all provided context
Middleware
Validation
By default this library try to validate request by checking headers:
- X-Api-Key (set on the
partner_apps
table) the system will try to match the headerX-Api-Key
with thepartner_apps
table. To enable, just add the middlewarepartner
on your desirable route
Logging
By default library try to translate and log following details:
Request
Request is resolved using Ipass/Request
controller
to use see the given example:
all given function are chain-able when extend method is used
Validate Validate request based on given rules set.
Arrify Convert request csv parameter to php array.
Boolify Convert request string 'true/false' parameter to php boolean.
Requestify Replace request given parameter value.
Response
Response helper
iresponse
or use by extending base controller[YOUR CONTROLLER] extends Ipaas/Response.php
, with that helper you can access sendError() method too, making an exception easier.
Set Meta Chain-able function to set response meta data
Set header Chain-able function to set response header data
Other Helpers
Converter
Ipaas/Helper/Converter-Helpers
Normalized Name
Replace ASCII space unicode with
space.
Input:
Response:
Boolify List Convert given string 'true/false' parameter to php boolean in provided array.
Input:
Response:
Note
ps. google/cloud package is required to run application on google app engine flex environment
Troubleshooting - Upgrade v1. to v2.
ilog()->data()
was changed toilog()->appendData()
;iresponse()
method was removed, useIpaas\Gapp\Response()
instead;- you do not need to instance the provider
Ipaas\IpaasServiceProvider::class
anymore, it is now automatically injected by composer; stackdriver
logging channel was changed tostack-driver
- all the
ilog()
setters were changed too:- client is now setClientId;
- key is now setClientKey;
- type is now setType;
- dateFrom is now setDateFrom;
- dateTo is now setDateTo;
- uuid is now setUuid;
- all the exception helpers were removed:
- iThrow;
- UnauthorizedException;
- BadRequestException;
- TooManyRequestException;
- NotFoundException;
- InternalServerException;
- all the response helpers were removed:
- errorValidation;
- errorUnauthorized;
- errorBadRequest;
- errorTooManyRequest;
- errorNotFound;
- errorNotImplemented;
- errorInternalServer;
All versions of gapp-laravel with dependencies
laravel/framework Version 5.*|6.*|7.*|8.*
google/cloud Version >=0.132
google/cloud-logging Version >=1.20
google/cloud-error-reporting Version >=0.16