esperlos / laravel_esperlos_boilerplate
A boilerplate for laravel designed to use laravel as backend and vue as frontend plus some improvements.
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 19
Type:project
Requires
- php: ^7.1.3
- fideloper/proxy: ^4.0
- laravel/framework: 5.8.*
- laravel/tinker: ^1.0
Requires (Dev)
- beyondcode/laravel-dump-server: ^1.0
- filp/whoops: ^2.0
- fzaninotto/faker: ^1.4
- krlove/eloquent-model-generator: ^1.3
- mockery/mockery: ^1.0
- nunomaduro/collision: ^3.0
- phpunit/phpunit: ^7.5
- dev-master
- 0.2.2
- 0.2.1
- 0.2
- 0.1
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/axios-0.21.1
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-4.0.1
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/acorn-6.4.1
- dev-dependabot/composer/symfony/http-foundation-4.4.1
- dev-dependabot/composer/symfony/mime-4.4.1
This package is not auto-updated.
Last update: 2025-03-02 23:10:51 UTC
README
Laravel Esperlos boilerplate
+CedarMapHelper for handling cedar map apis
+FirebaseHelper for handling firebase apis
+JalaliDateHelper, NumbersHelper for handling persian date and numbers
+SmsPanelHelper for handling sms panel apis
+UploadHelper for handling file and image uploads
+ResponseHelper, InputHelper for easier api handling using a better pattern
+ControllerGenerator to generate controllers with our pattern
+Setup vue, vuex, vue router, vuetify and other vue essential packages by default
+Done some other customizes for easier use of Helpers
+New example for Model/Controller/Vue files
Setup
composer create-project --prefer-dist esperlos/laravel_esperlos_boilerplate ProjectName
cd ProjectName
npm install
then you can set db configs, set migrations and so on ...
Generating Controller
This command will generate a controller in app/http/controller/api/ folder
php ControllerGenerator.php --name=ControllerName
Run
php artisan serve
npm run watch
Example Routes
default example route for vue:
default example routes for api:
http://localhost:8000/api/v1/example/create-example-user
Body:
{ "field_one":"Hello", "field_two":"Word" }
http://localhost:8000/api/v1/example/edit-example-profile
Body:
{ "api_token":"FLH7CMhUiDN54OkjFBxN1CeWnXIgjsJY36Gz3lCy7IEia81MO5lG9UW7efGK", "field_one":"Hello", "field_two":"Sajjad" }
http://localhost:8000/api/v1/example/get-example
Body:
{ "api_token":"FLH7CMhUiDN54OkjFBxN1CeWnXIgjsJY36Gz3lCy7IEia81MO5lG9UW7efGK", "field_one":"Hello", "field_two":"Sajjad" }
http://localhost:8000/api/v1/example/get-examples-list
Body:
{ "api_token":"FLH7CMhUiDN54OkjFBxN1CeWnXIgjsJY36Gz3lCy7IEia81MO5lG9UW7efGK", "offset":"0" }
InputHelper
This helper checks for valid input from user
-First parameter is just Request that you receive from controller function.
-Second parameter is an array of request parameters that you want to check.
-Last parameter is a callback function with Response parameter this function will be called when checks are passed.
Import:
use App\Http\Helpers\InputHelper;
Usage:
InputHelper::inputChecker( $request, [ $request->field_one, $request->field_two, // All fields that you need to check ], function (Request $request) { // Input is correct do something } );
If you don't need to check any fields:
InputHelper::inputChecker( $request, null, function (Request $request) { // Do something } );
ResponseHelper
This helper helps you to provide an integrated json response for all apis
-First parameter is error message, if you don't have any errors you can set null value for it.
-Second parameter is Http Response code.
-Last parameter is data that you want send to user. it can be an array or object or even a string.
Import:
use App\Http\Helpers\ResponseHelper;
Usage:
ResponseHelper::jsonResponse(null, Response::HTTP_OK, config('messages.success'))->send();
Sample Output:
{ "errors": null, "status": 200, "data": [ { "id": 2, "api_token": "FeDsHsoDjJZXd2gxl7c80WxYjobMB0ptzP3FZn5cU2wq4KIR21Y4qtssGoPx", "field_one": "Hello", "field_two": "Word", "created_at": "2019-05-31 12:25:11", "updated_at": "2019-05-31 12:25:11" }, { "id": 1, "api_token": "FLH7CMhUiDN54OkjFBxN1CeWnXIgjsJY36Gz3lCy7IEia81MO5lG9UW7efGK", "field_one": "Hello", "field_two": "Sajjad", "created_at": "2019-05-31 12:24:43", "updated_at": "2019-05-31 12:43:58" } ] }
CedarMapHelper
Import:
use App\Http\Helpers\CedarMapHelper;
Usage:
$directionsData = CedarMapHelper::getDirectionsData( (object) ['latitude' => $request->get('start_lat'), 'longitude' => $request->get('start_lng')], (object) ['latitude' => $request->get('end_lat'), 'longitude' => $request->get('end_lng')] );
FirebaseHelper
Import:
use App\Http\Helpers\FirebaseHelper;
Usage:
FirebaseHelper::sendFcmNotificationMessage($pushTokenArray, $data, 'Text');
SmsPanelHelper
Import:
use App\Http\Helpers\SmsPanelHelper;
Usage:
SmsPanelHelper::sendSms($phoneNumber), $tempCode);