larajs / core
Requires
- php: ^8.3
- illuminate/console: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/pagination: ^11.0|^12.0
- illuminate/routing: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.6
- phpunit/phpunit: ^9.5|^10.0
README
LaraJS Core is a PHP package providing core functionalities for Laravel applications, designed to streamline development and integrate seamlessly with JavaScript frontends.
Overview
This package includes:
- Base controller (
BaseLaraJSController
) - Helper functions (
Helper.php
) - Middleware for language handling (
LangMiddleware
) and request/response logging (LogRequestResponse
) - File service (
FileService
) - Traits for actions (
Action.php
) and user signatures (UserSignature.php
) - Artisan commands for generating boilerplate code.
Installation
You can install the package via composer:
composer require larajs/core
The package will automatically register its service provider.
Usage
Service Provider
The package's service provider LaraJS\Core\LaraJSCoreServiceProvider
is auto-discovered and registered.
Available Artisan Commands
This package provides several Artisan commands to help you generate common classes:
php artisan larajs:generate-action {name}
- Generates a new action class.php artisan larajs:generate-controller {name}
- Generates a new controller class.php artisan larajs:generate-repository {name}
- Generates a new repository class.php artisan larajs:setup
- Sets up the necessary files and configurations for LaraJS Core.
Controllers
Extend LaraJS\Core\Controllers\BaseLaraJSController
for your controllers to leverage base functionalities.
Helpers and Services
Utilize helpers and services provided in the LaraJS\Core\Helpers
and LaraJS\Core\Services
namespaces.
Contributing
Please see CONTRIBUTING for details. (You might want to create a CONTRIBUTING.md
file)
License
The MIT License (MIT). Please see License File for more information.