bjitgroup/reusable-lib-laravel

A BJIT Reusable Laravel Package

v3.0.0 2025-01-29 11:05 UTC

README

Overview

The BJIT Reusable Library Package is a lightweight and modular Laravel package designed to provide reusable components and features to streamline development.

Features

  • 🔥 Boilerplate Structure
  • 🔐 Auth Module
  • 🏗 Sample Module
  • 🎛 Permissions & Roles Management
  • 📝 Blog Module
  • 📁 Centralized File Handling
  • 🔔 Notifications (Email, Database, Push)

Installation

Requirements

  • Laravel v8+ (Latest Supported)
  • PHP with exec function enabled
  • Composer v2+ (Recommended)

Step 1: Install Laravel

composer create-project laravel/laravel rl-demo

Step 2: Install the Reusable Library

cd rl-demo  # Navigate to the project root
composer require bjitgroup/reusable-lib-laravel

Version Compatibility

Laravel Version Package Version Installation Command
11.x Latest composer require bjitgroup/reusable-lib-laravel
9.x - 10.x 2.x composer require bjitgroup/reusable-lib-laravel:2.*
8.x 1.x composer require bjitgroup/reusable-lib-laravel:1.*
  • Laravel 11.x : Use composer require bjitgroup/reusable-lib-laravel
  • Laravel 9.x to 10.x : Use composer require bjitgroup/reusable-lib-laravel:2.*
  • Laravel 8.x : Use composer require bjitgroup/reusable-lib-laravel:1.*

Step 3: Configure the .env File

Ensure the correct database connection and APP_URL settings:

APP_URL=http://localhost:8000

Step 4: Install the Reusable Library

php artisan bjit:reusable-lib-install

Step 5: Serve the Application

php artisan serve

Push Notification Setup

For Laravel 11.x (Reverb)

php artisan reverb:start

For Laravel 8.x - 10.x (Websockets)

php artisan websocket:serve

For Queue Processing

php artisan queue:work

Client-Side Configuration

  • Configure the client application with Key, Host, and Port.
  • Build the frontend application:
npm run build

API Documentation (Swagger)

Access the API documentation by opening your browser and navigating to:

http://localhost:8000/api/documentation

File Structure

The package follows a modular structure:

  1. Route - Configure API routes.
  2. Controller - Handle requests and responses.
  3. Request - Form validation logic.
  4. Service - Business logic handling.
  5. Repository - Database operations (CRUD).
  6. Resource - API response formatting.

Generate Module Files

php artisan bjit-make:model Products/Item -m --all

Options:

  • -m → Create migration
  • -s → Create seed file
  • -f → Create factory

You can also use -mfs --all at the end of the command to generate a migration, seed, and factory simultaneously.

Generate Service or Repository

php artisan bjit-make:service Products/ProductBrand
php artisan bjit-make:repository Products/ProductBrand

Remove a Module

php artisan bjit-remove:all Products/Item

Uninstall Reusable Library

php artisan bjit:reusable-lib-remove

License

This package is open-source software licensed under the MIT License.