定制 lajouizakariae/laravel-utils 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lajouizakariae/laravel-utils

最新稳定版本:0.0.3

Composer 安装命令:

composer require lajouizakariae/laravel-utils

包简介

Laravel package to publish different types of utils to laravel projects.

README 文档

README

Provides a single Artisan command that copies all utils into your application.

Installation

1. Require the package

Run:

composer require lajouizakariae/laravel-utils

The service provider is auto-discovered via composer.json's extra.laravel.providers.

2. Run the install command for CMI integration

php artisan utils:cmi-install

Use --force to overwrite files that already exist:

php artisan utils:cmi-install --force

What gets copied

Stub Destination
app/Enums/CardBrandEnum.php app/Enums/CardBrandEnum.php
app/Services/CmiService.php app/Services/CmiService.php
app/Http/Controllers/CmiController.php app/Http/Controllers/CmiController.php
config/cmi.php config/cmi.php
app/Events/CmiCallbackReceived.php app/Events/CmiCallbackReceived.php
app/Listeners/ProcessCmiPayment.php app/Listeners/ProcessCmiPayment.php
app/ValueObject/CmiCallbackData.php app/ValueObject/CmiCallbackData.php
app/ValueObject/CmiOrderData.php app/ValueObject/CmiOrderData.php
resources/views/cmi/layout.blade.php resources/views/cmi/layout.blade.php
resources/views/cmi/ok.blade.php resources/views/cmi/ok.blade.php
resources/views/cmi/fail.blade.php resources/views/cmi/fail.blade.php

The command also:

  • Appends CMI environment variables to your .env.example automatically.
  • Publishes the CMI migration via php artisan vendor:publish --tag=cmi-migrations.

Post-install steps

1. Fill in .env variables

The install command appends the following block to your .env.example. Copy them to your .env and fill in the values:

CMI_CLIENT_ID=your_client_id
CMI_STORE_KEY=your_store_key
CMI_GATEWAY_URL=https://test-lanacash.cmi.co.ma/fim/est3dgate
CMI_OK_URL=https://your-domain.com/cmi/ok
CMI_FAIL_URL=https://your-domain.com/cmi/fail
CMI_CALLBACK_URL=https://your-domain.com/api/cmi/callback
CMI_SHOP_URL=https://your-domain.com
CMI_LANG=fr

2. Register the event listener in AppServiceProvider

use App\Events\CmiCallbackReceived;
use App\Listeners\ProcessCmiPayment;
use Illuminate\Support\Facades\Event;

Event::listen(CmiCallbackReceived::class, ProcessCmiPayment::class);

3. Add routes

// routes/api.php
Route::get('/cmi/pay', [CmiController::class, 'pay'])->middleware('auth:sanctum');
Route::post('/cmi/callback', [CmiController::class, 'handleCallback']);

// routes/web.php
Route::get('/cmi/ok',   [CmiController::class, 'handleOk']);
Route::get('/cmi/fail', [CmiController::class, 'handleFail']);

4. Run the migration

php artisan migrate

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固