zofe/rapyd-admin
Composer 安装命令:
composer require zofe/rapyd-admin
包简介
rapyd admin for laravel
README 文档
README
Installation
Create new laravel app then install rapyd-admin package.
(answer “y” to the question about writes "allow-plugins" to composer.json)
composer create-project --prefer-dist laravel/laravel myapp
cd myapp
composer require zofe/rapyd-admin
Then you can customize roles & permissions in app/Modules/Auth/permissions.php then run
php artisan rpd:make:setup
#then you can serve the app with
php artisan serve
Now you can login with a default admin user:
admin@laravel
admin
Rapyd Admin
Rapyd Admin enhances Laravel by offering essential admin features with modular approach:
-
BALL Stack Environment: Bundles Bootstrap CSS, Alpine.js, Laravel, and Livewire for a quick boilerplate.
-
Layout Module: Classic sidebar/navbar design based on SBAdmin 3, updated to Bootstrap 5.3 with customizable SCSS and a variety of blade anonymous components for standardized, extendable frontends.
-
Auth Module: Robust authentication with socialite integration, Fortify, 2FA, and role/permission management.
-
Custom Modules: Structured handling of components and modules, REST API endpoints, and more, with an emphasis on reusable, encapsulated code for cleaner organization and maintainability.
Generators
Rapyd has some commands to generate models, components, modules (bundled components & views isolated in a folder) via artisan command line:
Models
generate a model (via command line)
php artisan rpd:make:model {ModelName}
# example
php artisan rpd:make:model Article
Livewire components
php artisan rpd:make {ComponentName} {Model}
# example
php artisan rpd:make UserTable User
will generate
laravel/
├─ app/
│ ├─ Livewire/
│ │ ├─ UserTable.php
│ resources/
│ │ ├─ views/
│ │ │ ├─livewire/
│ │ │ │ ├─ user_table.php
Modules & Generators
example of out of the box module structure you can use after installing rapyd-admin.
php artisan rpd:make {ComponentsName} {Model} --module={module}
# example
php artisan rpd:make Articles Article --module=Blog
- Will create
Blogfolder in you app/Modules directory. - Three livewire components in the
Livewiresubfolder (ArticlesEdit, ArticlesTable, ArticlesView) - Three blade components in the
Viewssubfolder (articles_edit, articles_table, articles_view) - Inside your Module folder you can reply (if needed) the laravel application folder structure (controllers, migrations, jobs, etc..)
laravel/
├─ app/
│ ├─ Modules/
│ │ ├─ Blog/
│ │ │ ├─ Livewire/
│ │ │ │ ├─ ArticlesEdit.php
│ │ │ │ ├─ ArticlesTable.php
│ │ │ │ ├─ ArticlesView.php
│ │ │ ├─ Views/
│ │ │ │ ├─ articles_edit.blade.php
│ │ │ │ ├─ articles_table.blade.php
│ │ │ │ ├─ articles_view.blade.php
│ │ │ ├─ routes.php
Blade views and Components
Table
A Table is a "listing component" with these features:
- "input filters" to search in a custom data set
- "buttons" (for example "add" record or "reset" filters)
- "pagination links"
- "sort links"
you can generate a Table component with:
php artisan rpd:make ArticlesTable Article
or and entire crud (Table/View/Edit) in a module named Blog with;
php artisan rpd:make Articles Article --module=Blog
Generated & Customized view can be something like:
# articles_view.blade.php ```html <x-rpd::table title="Article List" :items="$items" > <x-slot name="filters"> <x-rpd::input col="col-8" debounce="350" model="search" placeholder="search..." /> <x-rpd::select col="col-4" model="author_id" :options="$authors" placeholder="author..." addempty /> </x-slot> <table class="table"> <thead> <tr> <th> <x-rpd::sort model="id" label="id" /> </th> <th>title</th> <th>author</th> <th>body</th> </tr> </thead> <tbody> @foreach ($items as $article) <tr> <td> <a href="{{ route('articles.view',$article->id) }}">{{ $article->id }}</a> </td> <td>{{ $article->title }}</td> <td>{{ $article->author->firstname }}</td> <td>{{ Str::limit($article->body,50) }}</td> </tr> @endforeach </tbody> </table> </x-rpd::table>
props
title: the heading title for this crud
content/slots
- should be a html table that loops model $items
buttons: buttons panel
example: rapyd.dev/demo/articles
View
a View is a "detail page component" with :
- "buttons" slot (for example back to "list" or "edit" current record)
- "actions" any link that trigger a server-side
<x-rpd::view title="Article Detail"> <x-slot name="buttons"> <a href="{{ route('articles') }}" class="btn btn-outline-primary">list</a> <a href="{{ route('articles.edit',$model->getKey()) }}" class="btn btn-outline-primary">edit</a> </x-slot> <div>Title: {{ $article->title }}</div> <div>Author: {{ $article->author->firstname }} {{ $model->author->lastname }}</div> <div><a wire:click.prevent="someAction">Download TXT version</a></div> </x-rpd::view>
props
title: the heading title for this crud
content/slots
- should be a detail of $model
buttons: buttons panelactions: buttons panel
example: rapyd.dev/demo/article/view/1
Edit
Edit is a "form component" usually binded to a model with:
- "buttons" and "actions" (undo, save, etc..)
- form "fields"
- automatic errors massages / rules management
<x-rpd::edit title="Article Edit"> <x-rpd::input model="article.title" label="Title" /> <x-rpd::rich-text model="article.body" label="Body" /> </x-rpd::edit>
props
title: the heading title for this crud
content/slots
- form fields binded with public/model properties
example: rapyd.dev/demo/article/edit/1
Fields
inside some widget views you can drastically semplify the syntax using predefined blade components that interacts with livewire
<x-rpd::input model="search" debounce="350" placeholder="search..." />
<x-rpd::select model="author_id" lazy :options="$authors" />
<!-- tom select dropdown --> <x-rpd::select-list model="roles" multiple :options="$available_roles" label="Roles" /> or <x-rpd::select-list model="roles" multiple endpoint="/ajax/roles" label="Roles" />
<!-- date, datetime and date-range components --> <x-rpd::date-time model="date_time" format="dd/MM/yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" label="DateTime" /> <x-rpd::date model="date" format="dd/MM/yyyy" value-format="yyyy-MM-dd" label="Date" /> <x-rpd::date-range model_from="date_from" model_to="date_to" range-separator="-" start-placeholder="from" end-placeholder="to" type="daterange" format="dd/MM/yyyy" value-format="yyyy-MM-dd" />
<x-rpd::textarea model="body" label="Body" rows="5" :help="__('the article summary')"/>
<!-- quill wysiwyg editor --> <x-rpd::rich-text model="body" label="Body" />
props
label: label to display above the inputplaceholder: placeholder to use for the empty first optionmodel: Livewire model property keyoptions: array of options e.g. (used in selects)debounce: Livewire time in ms to bind data on keyuplazy: Livewire bind data only on changeprepend: addon to display before input, can be used via named slotappend: addon to display after input, can be used via named slothelp: helper label to display under the inputicon: Font Awesome icon to show before input e.g.cog,envelopesize: Bootstrap input size e.g.sm,lgrows: rows numsmultiple: allow multiple option selection (used in select-list)endpoint: a remote url for fetch optioms (used in select-list)format: the client-side field format (used in date and date-time)value-format: the server-side field value format (used in date and date-time)
special tags
<!-- sort ascending/descending link actions (in a datatable view context)--> <x-rpd::sort model="id" label="id" />
navigation
Nav Tabs: bootstrap nav-link menu with self-determined active link
<ul class="nav nav-tabs"> <x-rpd::nav-link label="Home" route="home" /> <x-rpd::nav-link label="Articles" route="articles" /> <x-rpd::nav-link label="Article Detail" route="articles.view" :params="1"/> <x-rpd::nav-link label="Article edit" route="articles.edit" /> </ul>
Nav Items: boostrap vertical menu items / single or grouped (collapsed)
<x-rpd::nav-dropdown icon="fas fa-fw fa-book" label="KnowledgeBase" active="/kb"> <x-rpd::nav-link label="Edit Categories" route="kb.admin.categories.table" type="collapse-item" /> <x-rpd::nav-link label="Edit Articles" route="kb.admin.articles.table" type="collapse-item" /> </x-rpd::nav-dropdown>
Nav Sidebar: bootstrap sidebar with self-determined or segment-based active link
<x-rpd::sidebar title="Rapyd.dev" class="p-3 text-white border-end"> <x-rpd::nav-item label="Demo" route="demo" active="/rapyd-demo" /> <x-rpd::nav-item label="Page" route="page" /> </x-rpd::sidebar>
Credits
Inspirations:
- rapyd-laravel my old laravel library (150k downloads)
- livewire widely used "full-stack framework" to compose laravel application by widgets
- laravel-bootstrap-components smart library which reduced the complexity of this one
License & Contacts
Rapyd is licensed under the MIT license
Please join me and review my work on Linkedin
thanks
zofe/rapyd-admin 适用场景与选型建议
zofe/rapyd-admin 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 148 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Rapyd」 「zofe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zofe/rapyd-admin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zofe/rapyd-admin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zofe/rapyd-admin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
crud widgets for laravel 5.1, to make an admin in few lines of code
crud widgets for laravel, to make an admin in few lines of code
rapyd-livewire
crud widgets for laravel, to make an admin in few lines of code(custom for my project only)
Rapyd driver for the Omnipay payment processing library
crud widgets for laravel, to make an admin in few lines of code
统计信息
- 总下载量: 148
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-11
