Welcome to RCV Core

Enterprise-grade modular architecture for Laravel applications. Build scalable, maintainable applications using a module-based approach with Service Repository Pattern, event-driven architecture, and 50+ Artisan commands.

Why Choose RCV Core?

+37%
150ms → 95ms
Boot Time
-29%
45MB → 32MB
Memory Usage
+70%
50ms → 15ms
Route Registration
+58%
200ms → 85ms
Asset Loading

Installation

Get started with RCV Core in your Laravel application in just a few steps.

Requirements

Requirement Version Status
PHP ≥ 8.0 ✅ Supported
Laravel 9.x - 12.x ✅ Supported
Composer Latest ✅ Required

Quick Start

Installation Steps

composer require rcv/core

Install via Composer

composer require rcv/core
php artisan vendor:publish --tag=core-module-migrations

Publish Migration

php artisan vendor:publish --tag=core-module-migrations
php artisan migrate

Run Migrations

php artisan migrate
php artisan module:make UserManagement

Create your first module

php artisan module:make UserManagement
php artisan module:marketplace install UserManagement

Install your first module

php artisan module:marketplace install UserManagement

Quick Start

Bootstrap your first module and start building scalable applications immediately.

Starting a New Module

15
Commands
Complete Setup
5 min
Setup Time
From Zero
100%
Structure
Generated

Module Creation Workflow

php artisan module:make Ecommerce

Create a complete e-commerce module

php artisan module:make Ecommerce
php artisan module:marketplace install Ecommerce

Install e-commerce module

php artisan module:marketplace install Ecommerce
php artisan module:make-model Product Ecommerce

Generate Product model

php artisan module:make-model Product Ecommerce
php artisan module:make-controller ProductController Ecommerce --resource

Create resource controller with CRUD

php artisan module:make-controller ProductController Ecommerce --resource
php artisan module:make-service ProductService Ecommerce

Generate business logic service

php artisan module:make-service ProductService Ecommerce
php artisan module:migrate Ecommerce

Run module migrations

php artisan module:migrate Ecommerce

Performance Metrics

Real-world performance improvements when using RCV Core compared to traditional Laravel applications.

Benchmark Comparison

Feature Traditional Laravel With RCV Core Improvement
Boot Time 150ms 95ms 37% faster
Memory Usage 45MB 32MB 29% less
Route Registration 50ms 15ms 70% faster

Module System

Discover how the module system enables scalable and maintainable Laravel applications.

Module Management Commands

php artisan module:make ModuleName

Create new module with complete structure

php artisan module:make ModuleName
php artisan module:enable ModuleName

Enable specific module

php artisan module:enable ModuleName
php artisan module:disable ModuleName

Disable module (safe/destructive options)

php artisan module:disable ModuleName
php artisan module:marketplace install ModuleName

Install module with dependencies

php artisan module:marketplace install ModuleName

Interactive Command Explorer

Explore our comprehensive suite of 50+ Artisan commands organized by category.

Command Suite

50+ commands for module management and development

All Management Generation Database Development

Security

Explore the robust security features and best practices integrated into RCV Core to protect your Laravel applications.

Built-in Security Features

Input Validation

Comprehensive request validation to ensure data integrity.

Authorization

Policy-based authorization for fine-grained access control.

CSRF Protection

Automatic CSRF token handling for secure form submissions.

SQL Injection Prevention

Eloquent ORM protection against SQL injection attacks.

XSS Prevention

Blade template escaping to mitigate cross-site scripting.

Security Best Practices

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateUserRequest extends FormRequest
{
    public function rules()
    {
        return [
            'name' => 'required|string|max:255|regex:/^[a-zA-Z\s]+$/',
            'email' => 'required|email|unique:users,email|max:255',
            'password' => 'required|string|min:8|confirmed|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/',
        ];
    }

    protected function prepareForValidation()
    {
        $this->merge([
            'name' => strip_tags($this->name),
            'email' => filter_var($this->email, FILTER_SANITIZE_EMAIL),
        ]);
    }
}
            

Implement GDPR compliance with methods for data export, anonymization, and secure deletion.

Architecture

Explore the robust modular architecture and design principles of RCV Core, designed for scalability and maintainability.

Directory Structure

/vendor/rcv/core/
└── src/
    ├── Config/              # Configuration files
    ├── Console/            # Artisan commands
    │   └── Commands/
    ├── Database/           # Migrations and seeders
    │   └── Migrations/
    ├── Http/              # HTTP related files
    │   ├── Controllers/
    │   └── Middleware/
    ├── Models/            # Eloquent models
    ├── Providers/         # Service providers
    ├── Resources/         # Views and assets
    │   ├── views/
    │   └── lang/
    ├── Routes/            # Route definitions
    └── Services/          # Business logic services

Design Principles

Separation of Concerns

Each module handles a specific domain of your application.

Dependency Injection

Leverages Laravel's service container for better testability.

Convention over Configuration

Follows Laravel conventions to reduce configuration overhead.

Extensibility

Easy to extend and customize through hooks and events.

Testing

Learn how to thoroughly test your modules with comprehensive unit and feature tests in RCV Core.

Unit Testing Example

<?php

namespace Modules\UserManagement\Tests\Unit;

use Modules\UserManagement\Services\UserService;
use Modules\UserManagement\Repositories\UserRepository;
use RCV\Core\Tests\TestCase;

class UserServiceTest extends TestCase
{
    protected $userService;
    protected $userRepository;

    public function setUp(): void
    {
        parent::setUp();
        
        $this->userRepository = $this->mock(UserRepository::class);
        $this->userService = new UserService($this->userRepository);
    }

    public function test_can_create_user()
    {
        $userData = [
            'user' => ['name' => 'John Doe', 'email' => 'john@example.com'],
            'profile' => ['phone' => '123-456-7890']
        ];

        $this->userRepository
            ->shouldReceive('createWithProfile')
            ->once()
            ->andReturn(new User($userData['user']));

        $user = $this->userService->createUser($userData);

        $this->assertInstanceOf(User::class, $user);
    }
}
            

Feature Testing Example

<?php

namespace Modules\UserManagement\Tests\Feature;

use RCV\Core\Tests\TestCase;

class UserControllerTest extends TestCase
{
    public function test_can_create_user_via_api()
    {
        $userData = [
            'name' => 'John Doe',
            'email' => 'john@example.com',
            'password' => 'password123',
            'password_confirmation' => 'password123'
        ];

        $response = $this->postJson('/api/users', $userData);

        $response->assertStatus(201)
                ->assertJsonStructure([
                    'data' => [
                        'id',
                        'name', 
                        'email',
                        'created_at'
                    ]
                ]);

        $this->assertDatabaseHas('users', [
            'email' => 'john@example.com'
        ]);
    }
}
            

Real-world Examples

Practical implementations and use cases demonstrating RCV Core in production environments.

E-commerce Module Implementation

# Create e-commerce module with all components
php artisan module:make Ecommerce

# Generate core components
php artisan module:make-model Product Ecommerce
php artisan module:make-controller ProductController Ecommerce --api
php artisan module:make-service ProductService Ecommerce  
php artisan module:make-repository ProductRepository Ecommerce

# Create supporting classes
php artisan module:make-request CreateProductRequest Ecommerce
php artisan module:make-resource ProductResource Ecommerce
php artisan module:make-event ProductCreated Ecommerce
<?php
namespace Modules\Ecommerce\Services;

use Modules\Ecommerce\Repositories\ProductRepository;
use Modules\Ecommerce\Events\ProductCreated;

class ProductService
{
    public function __construct(
        private ProductRepository $productRepository
    ) {}

    public function createProduct(array $data): Product
    {
        $product = $this->productRepository->create($data);
        
        // Handle image uploads
        if (isset($data['images'])) {
            $this->handleProductImages($product, $data['images']);
        }
        
        // Fire event for other modules to listen
        event(new ProductCreated($product));
        
        return $product;
    }

    public function getFeaturedProducts(int $limit = 10): Collection
    {
        return $this->productRepository->getFeatured($limit);
    }
}
<?php
namespace Modules\Ecommerce\Repositories;

use RCV\Core\Repositories\BaseRepository;
use Modules\Ecommerce\Models\Product;

class ProductRepository extends BaseRepository
{
    protected $model = Product::class;

    public function getFeatured(int $limit): Collection
    {
        return $this->model->where('featured', true)
                          ->where('status', 'active')
                          ->with(['category', 'images'])
                          ->take($limit)
                          ->get();
    }

    public function searchProducts(array $filters): Collection
    {
        $query = $this->model->query();
        
        if (isset($filters['category'])) {
            $query->where('category_id', $filters['category']);
        }
        
        if (isset($filters['price_range'])) {
            $query->whereBetween('price', $filters['price_range']);
        }
        
        return $query->get();
    }
}
<?php
namespace Modules\Ecommerce\Http\Controllers\Api;

use Illuminate\Http\JsonResponse;
use Modules\Ecommerce\Services\ProductService;
use Modules\Ecommerce\Http\Requests\CreateProductRequest;
use Modules\Ecommerce\Http\Resources\ProductResource;

class ProductController extends Controller
{
    public function __construct(
        private ProductService $productService
    ) {}

    public function index(): JsonResponse
    {
        $products = $this->productService->getFeaturedProducts();
        
        return response()->json([
            'data' => ProductResource::collection($products),
            'meta' => [
                'total' => $products->count(),
                'featured' => true
            ]
        ]);
    }

    public function store(CreateProductRequest $request): JsonResponse
    {
        $product = $this->productService->createProduct(
            $request->validated()
        );
        
        return response()->json([
            'data' => new ProductResource($product),
            'message' => 'Product created successfully'
        ], 201);
    }
}

Multi-tenant SaaS Implementation

Complete example of building a multi-tenant application with tenant-specific modules.

Tenant A

  • CRM Module
  • Billing Module
  • Analytics Module

Tenant B

  • E-commerce Module
  • Inventory Module
  • Shipping Module

Core Modules

  • Authentication
  • User Management
  • Notification

Advanced Configuration

Master RCV Core configuration with environment-specific settings, performance tuning, and security options.

Complete Configuration Reference

Basic Configuration (config/rcv-core.php)

<?php
                            return [
                                /*
                                |--------------------------------------------------------------------------
                                | Module Configuration
                                |--------------------------------------------------------------------------
                                */
                                'namespace' => 'Modules',
                                'stubs' => [
                                    'enabled' => true,
                                    'path' => base_path('vendor/rcv/core/src/Commands/stubs'),
                                    'files' => [
                                        'routes/web' => 'Routes/web.php',
                                        'routes/api' => 'Routes/api.php',
                                        'scaffold/config' => 'Config/config.php',
                                        'composer' => 'composer.json',
                                        'assets/js/app' => 'Resources/assets/js/app.js',
                                        'assets/sass/app' => 'Resources/assets/sass/app.scss',
                                    ],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Paths Configuration
                                |--------------------------------------------------------------------------
                                */
                                'paths' => [
                                    'modules' => base_path('Modules'),
                                    'assets' => public_path('modules'),
                                    'migration' => base_path('database/migrations'),
                                    'generator' => [
                                        'config' => ['path' => 'Config', 'generate' => true],
                                        'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
                                        'migration' => ['path' => 'Database/Migrations', 'generate' => true],
                                        'routes' => ['path' => 'Routes', 'generate' => true],
                                        'controller' => ['path' => 'Http/Controllers', 'generate' => true],
                                        'filter' => ['path' => 'Http/Middleware', 'generate' => true],
                                        'request' => ['path' => 'Http/Requests', 'generate' => true],
                                        'provider' => ['path' => 'Providers', 'generate' => true],
                                        'assets' => ['path' => 'Resources/assets', 'generate' => true],
                                        'lang' => ['path' => 'Resources/lang', 'generate' => true],
                                        'views' => ['path' => 'Resources/views', 'generate' => true],
                                        'test' => ['path' => 'Tests', 'generate' => true],
                                        'repository' => ['path' => 'Repositories', 'generate' => false],
                                        'event' => ['path' => 'Events', 'generate' => false],
                                        'listener' => ['path' => 'Listeners', 'generate' => false],
                                        'policies' => ['path' => 'Policies', 'generate' => false],
                                        'rules' => ['path' => 'Rules', 'generate' => false],
                                        'jobs' => ['path' => 'Jobs', 'generate' => false],
                                        'emails' => ['path' => 'Emails', 'generate' => false],
                                        'notifications' => ['path' => 'Notifications', 'generate' => false],
                                        'resource' => ['path' => 'Transformers', 'generate' => false],
                                        'component' => ['path' => 'View/Components', 'generate' => false],
                                    ],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Scan Path
                                |--------------------------------------------------------------------------
                                */
                                'scan' => [
                                    'enabled' => false,
                                    'paths' => [
                                        base_path('vendor/*/*'),
                                    ],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Package Commands
                                |--------------------------------------------------------------------------
                                */
                                'commands' => [
                                    'ModuleMakeCommand',
                                    'ModuleEnableCommand',
                                    'ModuleDisableCommand',
                                    'ModuleMarketplaceInstallCommand',
                                    'ModuleMarketplaceRemoveCommand',
                                    'ModuleMarketplaceUpdateCommand',
                                    'ModulePublishConfigCommand',
                                    'ModulePublishMigrationCommand',
                                    'ModulePublishTranslationCommand',
                                    // ... other commands as needed
                                ],
                            ];
                            

Performance Optimization Settings

                            // Add to config/rcv-core.php
                            'performance' => [
                                /*
                                |--------------------------------------------------------------------------
                                | Module Caching
                                |--------------------------------------------------------------------------
                                */
                                'cache' => [
                                    'enabled' => env('RCV_CACHE_ENABLED', true),
                                    'key' => 'rcv_modules',
                                    'lifetime' => env('RCV_CACHE_LIFETIME', 3600), // 1 hour
                                    'store' => env('RCV_CACHE_STORE', 'redis'),
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Lazy Loading
                                |--------------------------------------------------------------------------
                                */
                                'lazy_loading' => [
                                    'enabled' => env('RCV_LAZY_LOADING', true),
                                    'threshold' => 50, // Load modules when needed if > 50 modules
                                    'autoload_exclude' => [
                                        'Core', // Modules always loaded
                                        'Authentication',
                                    ],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Route Caching
                                |--------------------------------------------------------------------------
                                */
                                'route_cache' => [
                                    'enabled' => env('RCV_ROUTE_CACHE', true),
                                    'prefix' => 'rcv_routes',
                                    'exclude_patterns' => ['admin/*', 'debug/*'],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Asset Optimization
                                |--------------------------------------------------------------------------
                                */
                                'assets' => [
                                    'minify' => env('RCV_MINIFY_ASSETS', true),
                                    'combine' => env('RCV_COMBINE_ASSETS', true),
                                    'version' => env('RCV_VERSION_ASSETS', true),
                                    'cdn_url' => env('RCV_CDN_URL', null),
                                    'manifest' => public_path('modules/mix-manifest.json'),
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Queue Optimization
                                |--------------------------------------------------------------------------
                                */
                                'queue' => [
                                    'enabled' => env('RCV_QUEUE_ENABLED', true),
                                    'connection' => env('RCV_QUEUE_CONNECTION', 'redis'),
                                    'priority' => [
                                        'high' => ['jobs', 'notifications'],
                                        'medium' => ['events'],
                                        'low' => ['analytics', 'logs'],
                                    ],
                                ],
                            ],
                            
                        
Performance Best Practices
  • Enable Redis Caching: Use Redis for module metadata caching to reduce database queries.
  • Route Optimization: Cache module routes in production for faster route resolution.
  • Lazy Loading: Enable lazy loading for large applications to load modules only when needed.
  • Asset Bundling: Combine and minify module assets to reduce HTTP requests.
  • Queue Optimization: Prioritize critical jobs and use Redis for faster queue processing.

Security Configuration

                            // Add to config/rcv-core.php
                            'security' => [
                                /*
                                |--------------------------------------------------------------------------
                                | Module Permissions
                                |--------------------------------------------------------------------------
                                */
                                'permissions' => [
                                    'enable_modules' => ['admin', 'super_admin'],
                                    'disable_modules' => ['admin', 'super_admin'],
                                    'install_modules' => ['super_admin'],
                                    'delete_modules' => ['super_admin'],
                                    'publish_configs' => ['admin', 'super_admin'],
                                    'access_marketplace' => ['super_admin'],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Module Validation
                                |--------------------------------------------------------------------------
                                */
                                'validation' => [
                                    'require_signature' => env('RCV_REQUIRE_SIGNATURE', true),
                                    'allowed_sources' => [
                                        'official' => 'https://marketplace.rcvtechnologies.com',
                                        'github' => 'github.com/rcv-technologies/*',
                                    ],
                                    'blocked_modules' => [
                                        'DeprecatedModule',
                                        'InsecureModule',
                                    ],
                                    'signature_key' => env('RCV_SIGNATURE_KEY', null),
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Code Security
                                |--------------------------------------------------------------------------
                                */
                                'code_security' => [
                                    'scan_for_malicious_code' => env('RCV_SCAN_CODE', true),
                                    'allowed_functions' => [
                                        'safe' => ['str_contains', 'array_merge', 'collect'],
                                        'restricted' => ['eval', 'exec', 'system'],
                                    ],
                                    'sanitize_inputs' => [
                                        'enabled' => env('RCV_SANITIZE_INPUTS', true),
                                        'fields' => ['name', 'description', 'content'],
                                        'methods' => ['strip_tags', 'htmlspecialchars'],
                                    ],
                                    'csrf_protection' => [
                                        'enabled' => env('RCV_CSRF_PROTECTION', true),
                                        'except' => ['api/*'],
                                    ],
                                ],

                                /*
                                |--------------------------------------------------------------------------
                                | Audit Logging
                                |--------------------------------------------------------------------------
                                */
                                'audit' => [
                                    'enabled' => env('RCV_AUDIT_LOGGING', true),
                                    'log_events' => [
                                        'module_installed',
                                        'module_enabled',
                                        'module_disabled',
                                        'module_removed',
                                    ],
                                    'log_driver' => env('RCV_AUDIT_DRIVER', 'database'),
                                    'retention_days' => env('RCV_AUDIT_RETENTION', 90),
                                ],
                            ],
                            
                        
Security Best Practices
  • Restrict Module Operations: Limit module management to super_admin roles.
  • Validate Module Sources: Only allow trusted marketplace sources.
  • Code Scanning: Enable malicious code scanning for third-party modules.
  • Input Sanitization: Automatically sanitize user inputs to prevent XSS.
  • Audit Logging: Track all module-related actions for security monitoring.

Environment-Specific Configuration

                            # .env file
                                # Module Settings
                                RCV_MODULE_NAMESPACE=Modules
                                RCV_STUBS_ENABLED=true

                                # Cache Settings
                                RCV_CACHE_ENABLED=true
                                RCV_CACHE_LIFETIME=3600
                                RCV_CACHE_STORE=redis

                                # Lazy Loading
                                RCV_LAZY_LOADING=true
                                RCV_LAZY_THRESHOLD=50

                                # Route Caching
                                RCV_ROUTE_CACHE=true
                                RCV_ROUTE_PREFIX=rcv_routes

                                # Asset Optimization
                                RCV_MINIFY_ASSETS=true
                                RCV_COMBINE_ASSETS=true
                                RCV_VERSION_ASSETS=true
                                RCV_CDN_URL=https://cdn.rcvtechnologies.com

                                # Queue Configuration
                                RCV_QUEUE_ENABLED=true
                                RCV_QUEUE_CONNECTION=redis

                                # Security Settings
                                RCV_REQUIRE_SIGNATURE=true
                                RCV_SIGNATURE_KEY=your-signature-key
                                RCV_SCAN_CODE=true
                                RCV_SANITIZE_INPUTS=true
                                RCV_CSRF_PROTECTION=true
                                RCV_AUDIT_LOGGING=true
                                RCV_AUDIT_DRIVER=database
                                RCV_AUDIT_RETENTION=90
                            
                        
Environment Configuration Tips
  • Environment Variables: Use .env for sensitive configuration values.
  • Production Settings: Enable caching and minification in production.
  • Development Settings: Disable caching for easier debugging.
  • Testing Environment: Use in-memory cache store for faster tests.
  • Security Keys: Store signature keys in secure vault services.