GoosePHP API
GoosePHP is a boilerplate package you can install on any existing Laravel 5.4 website. The package gives you access to a user panel, admin users, collaborators, and numerous features, amongst others Blog, Shopping Cart, Payment Gateways, Mailing List, Google Analytics, Google Captcha etc.
How to install GoosePHP
Composer
Begin by installing this package through Composer.
composer require "goosephp/goosephp"
Then run composer update
Register Service Provider and Facade
Then register the service providers and Facades in config/app.php
goosephp\goosephp\GoosephpServiceProvider::class,
'Goosephp' => goosephp\goosephp\GoosephpFacade::class,
Now you can use the Goosephp
facade anywhere in your application
.env
file
Add the following environment variables to the GOOSEPHP_SITE=your_site_url.com
GOOSEPHP_SECRET_KEY=your_secret_key
Register the Middleware
Add the following to the $middlewareGroups array in app/Http/Kernel.php
'authorization' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],
'panel' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\goosephp\goosephp\middleware\Authorized::class,
],
You need to update the $routeMiddleware
array with
'administrator' => \goosephp\goosephp\middleware\Administrator::class,
'authorized' => \goosephp\goosephp\middleware\Authorized::class,
Exception Handling
In order to receive exception emails, setup any email service provider of your choice in the config/mail.php
file, and
then add the following line in the report
method of the app/Exceptions/Handler.php
file
\goosephp\goosephp\api\ExceptionHandler::handle($exception, "<email_address>");
To handle exceptions on ajax requests, add the following in the render
method
if ($request->ajax()){
return json_encode([
'status' => false,
'message' => 'Something went wrong',
'exception' => $exception->getMessage(),
'trace' => $exception->getTrace()
]);
}
Access the Panel
You can now use the following routes to start using your panel:
User Registration
http//your.domain.com/panel/create-account
Sign In
http//your.domain.com/panel/sign-in
Password Reset
http//your.domain.com/panel/forgot-password