承接 mubeen/laravel-user-crud 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mubeen/laravel-user-crud

最新稳定版本:v2.0.0

Composer 安装命令:

composer require mubeen/laravel-user-crud

包简介

Laravel package for user CRUD operations and authentication

README 文档

README

A Laravel 12 package that provides complete user management with authentication and CRUD operations out of the box. Supports both web and API interfaces with multiple authentication providers.

Requirements

  • PHP 8.2+
  • Laravel 12.x

Features

  • Complete user management (CRUD)
  • Authentication (login, register, logout)
  • Works with both web and API interfaces
  • API support for multiple authentication providers:
    • Laravel Sanctum
    • Laravel Passport
    • JWT Auth

Installation

You can install this package via composer:

composer require mubeen/laravel-user-crud

After installing the package, run the installation command which will prompt you to choose your preferred interface (web or API) and authentication provider:

php artisan laravel-user-crud:install

The installer will create the necessary configuration, publish resources, and guide you through setting up any additional dependencies.

Configuration

The installation command generates a configuration file, but you can also publish it manually:

php artisan vendor:publish --provider="Mubeen\LaravelUserCrud\LaravelUserCrudServiceProvider" --tag="laravel-user-crud"

This will publish the following files:

  • Configuration file: config/laravel-user-crud.php
  • Migrations: database/migrations/
  • Views (if web interface): resources/views/vendor/laravel-user-crud/

Usage

Web Interface

If you chose the web interface during installation, you'll have access to these routes:

Authentication

  • Login: /login
  • Register: /register
  • Logout: POST to /logout

User Management

User management routes are prefixed with /admin by default (configurable):

  • List users: /admin/users
  • Create user: /admin/users/create
  • Show user: /admin/users/{user}
  • Edit user: /admin/users/{user}/edit
  • Delete user: DELETE to /admin/users/{user}

API Interface

If you chose the API interface during installation, you'll have access to these endpoints:

Authentication

  • Login: POST to /auth/login
  • Register: POST to /auth/register
  • Logout: POST to /auth/logout (requires authentication)
  • Get profile: GET to /auth/profile (requires authentication)
  • Update profile: PUT to /auth/profile (requires authentication)

User Management

User management endpoints are prefixed with /api by default (configurable):

  • List users: GET to /api/users
  • Create user: POST to /api/users
  • Show user: GET to /api/users/{user}
  • Update user: PUT/PATCH to /api/users/{user}
  • Delete user: DELETE to /api/users/{user}

Authentication Providers

When using the API interface, you can choose from three authentication providers:

Laravel Sanctum

Ideal for SPAs, mobile applications, and simple API tokens. The package will automatically add necessary authentication setup.

Laravel Passport

More feature-rich OAuth2 server. Suitable for creating OAuth2 APIs with personal access tokens, password grants, and more.

JWT Auth

JSON Web Token authentication for stateless API authentication.

Customization

You can customize the behavior in the configuration file:

// config/laravel-user-crud.php

return [
    // Interface type: 'web' or 'api'
    'interface_type' => 'web',
    
    // Auth provider for API: 'sanctum', 'passport', or 'jwt'
    'auth_provider' => null,
    
    // Routes prefix for all the package routes
    'route_prefix' => 'admin',
    
    // Middleware to apply to the routes
    'middleware' => ['web', 'auth'],
    
    // Admin routes middleware 
    'admin_middleware' => ['web', 'auth'],
    
    // View layout to extend (for web interface)
    'layout' => 'layouts.app',
    
    // Additional user fields
    'additional_user_fields' => [],
    
    // API response settings
    'api_pagination_limit' => 15,
    
    // Token settings (for Sanctum/Passport)
    'token_name' => 'User Management',
    'token_expiration_days' => 30,
];

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-18