adr1enbe4udou1n/laravel-boilerplate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

adr1enbe4udou1n/laravel-boilerplate

Composer 安装命令:

composer create-project adr1enbe4udou1n/laravel-boilerplate

包简介

Laravel 5.7 Boilerplate based on Bootstrap 4 and Tabler for Backend.

README 文档

README

This is a Bootstrap 4 starter kit site with lite blogging feature, user account registration/management and full Vue Tabler Backend based on Laravel 5.7.

Build Status StyleCI License code style: prettier

Demo

Features

Frontend

  • Bootstrap 4 Frontend with basic home-about-contact and legal mentions pages,
  • Slick carousel and Cookie Consent integrated,
  • Blog section, including navigation by tags & authors,
  • Intervention image for dynamic optimized images with cache plugin,
  • Turbolinks included for fast navigation,
  • Login throttle by recaptcha & password strength meter,
  • Frontend user space and profile management. Email validation included. Registration can be disabled by environment parameter,
  • Laravel Socialite included with all supported socialite providers (facebook/twitter/linkedin/github/bitbucket).

Backend

Underlying layer

  • Based on Bootstrap 4 Tabler theme with many useful plugins (SweetAlert2, Flatpickr, CKEditor 5, etc.),
  • Entirely written with Vue components thanks to Bootstrap-Vue, absolutely no jQuery dependency,
  • Vue-route for instant client-side navigation,
  • Native Vue Datatable, with everywhere search input and batch actions features,
  • All main CRUD actions are ajaxified,
  • Native vue-select component for powerful select system (autocomplete, tags, etc.),
  • Excel Export (thanks to Maatwebsite) & Batch actions integrated within DataTables,
  • Instant search engine (for posts) thanks to Laravel Scout & TNTSearch.

Features included

  • User and permissions management (classic users <-> roles <-> permissions structure),
  • Impersonation feature for quick user context testing,
  • Frontend forms module, including settings (recipients and translatable message confirmation) & submissions management,
  • Posts management for frontend blog, with granular publication permissions (classic draft-pending-published workflow). Posts include title, summary, html body, tags, featured image, metas. They can be published and/or unpublished at specific datetime and pinned if needed. Specific user can have limited access to his own posts only, according to his permissions,
  • Wysiwyg drag & drop image upload.

Localization & SEO

  • Multilingual ready thanks to Laravel Localization package. Each routes are prefixed by locale in URL for best SEO support. For this boilerplate, EN, FR locales are 100% supported, including translated routes,
  • Spanish language added thanks to Codedeep,
  • Arabic language with RTL support added thanks to AhmadOf,
  • Russian language added thanks to Limych,
  • Model Translatable Fields support (JSON format) with Spatie Laravel Translatable, used for metatags and posts,
  • Robots and Sitemap integrated, including multilingual alternates,
  • Full Metatags manager interface with translatable title & description. Meta entity can be either linked to route or specific entity like post,
  • 301/302 redirections manager interface, with CSV import feature.

Developer Specific

  • Usage of Spatie Laravel Medialibrary package for orderable media model management, used for featured image on posts,
  • Permissions configuration based on config file rather than database,
  • Form types defined on config file for settings & submission support. This boilerplate include just one "contact form" type,
  • Custom webpack integration rather than laravel mix, for better flexibility (cf bellow),

Install

Requirements

  • PHP 7.1
  • MySQL 5.7 with JSON support or PostgreSQL

For Mariadb you can use this laravel-mariadb package.

Deploy

  1. composer create-project --prefer-dist --stability=dev adr1enbe4udou1n/laravel-boilerplate my-new-project
  2. Set database and environment variables from .env.example
  3. Set Web write permission if needed to bootstrap/cache and storage folders.
  4. Launch follow commands :

For Local/Development

composer install
php artisan key:generate
php artisan storage:link
php artisan migrate [--seed]

For Production

# Running this on development environment will throw error so run below command only on production
composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan storage:link
php artisan migrate --force

Initialize search index for posts

php artisan scout:import "App\Models\Post"

Laravel Scout takes care of updating posts index on Create, Update and Delete (CUD) operations.

Install with docker-compose

After installation the site will be available on 127.0.0.1:8080

Mac and Linux dev environment

First of all you need to build the containers

docker-compose build

After that you have to start the containers

docker-compose up

Set up your application

docker exec -it boilerplate-php-fpm php /app/artisan key:generate \
	&& docker exec -it boilerplate-php-fpm php /app/artisan storage:link

Rename .env.docker to .env and apply the migrations

docker exec -it boilerplate-php-fpm php /app/artisan migrate

Or apply the migrations with demo data

docker exec -it boilerplate-php-fpm php /app/artisan migrate --seed

Mac and Linux production environment

docker-compose build

After that you have to start the containers

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Set up your application

docker exec -it boilerplate-php-fpm php /app/artisan key:generate \
	&& docker exec -it boilerplate-php-fpm php /app/artisan storage:link

Rename .env.docker to .env and apply the migrations

docker exec -it boilerplate-php-fpm php /app/artisan migrate

Install with make file

Deploy dev

Run

make build
make start.dev

After first start rename .env.docker to .env and apply the migrations by the following command

make install.dev

Deploy prod

Run

make build
make start.prod

After first start rename .env.docker to .env and apply the migrations by the following command

make install.prod

Install on Windows

First of all set up your docker environment

  • On Command Line: set COMPOSE_CONVERT_WINDOWS_PATHS=1;
  • Restart Docker for Windows;
  • Go to Docker for Windows settings > Shared Drives > Reset credentials > select drive > Apply;
  • Reopen Command Line
  • Kill the Containers (if you have started any)
  • Rerun the Containers (if you have run any)
  • Login the docker from cli, because docker login gui is separated from docker login cli. Also note, that you do not have to use your email, you need to enter docker id
Note, if the prompt from the needed drive disapears after restarting the container
You may have to reset your docker:
Go to Docker for Windows settings > Reset > Reset to factory defaults...

Than you can proceed with Mac and Linux install instructions section

Backend access

The first user to register will be automatically super admin with no restriction and will cannot be deletable. Both frontend and backend have dedicated login pages.

Development notes

Compiling assets with Webpack

  1. Install dependencies with yarn
  2. Launch yarn dev for compiling assets and start dev-server with HMR enabled (preferred way for fast admin building)

N1 : Use DEV_SERVER_PORT variable to configure local port of Webpack Dev Server,
N2 : Use DEV_SERVER_URL to configure HTTP access to Webpack Dev Server from your host, especially useful if you work on homestead/docker),
N3 : Use yarn watch if you prefer old school watcher,
N4 : If assets modified, don't forget to launch yarn prod before deploy on production environment.

Permissions definitions

Unlike other known project as ENTRUST or laravel-permission, which are very well suited for generic roles/permissions, i preferred a more lite and integrated custom solution.

The mainly difference is that instead of store all permissions into specific SQL table, there are directly defined in a specific config file permissions. SQL side, roles entities relies only to a list of permissions key names.

Indeed i feel this approach better for maintainability simply because permissions are hardly tied to the application with Laravel Authorization. This is anyway the standard way in CMS as Drupal where each module have specific config permission file. Permissions should be only owned by developers.

Note on Laravel Mix

You will observe that this boilerplate does not use Laravel Mix which is shipped in Laravel for all assets management.

Laravel Mix still stay awesome for newcomers thanks to Jeffrey Way's laravel-like webpack fluent API, but, even if Laravel Mix can be easily overridden, for this project i preferred use my custom framework-free webpack setup in order to have total control of assets workflow.

For instance, with this custom setup HMR work natively with configurable port (essential for easy vue admin development) and productions assets are bundled into specific "dist" directory.

Code styling

PHP-CS-Fixer & ESLint are used for strong style guidelines for both server and client side code.

PHP is pre-configured for official Laravel styling, just launch ./vendor/bin/php-cs-fixer fix for global project auto-formatting.

JS use Prettier Standard Style & eslint-loader is used within webpack for dynamic code styling recommendations.
Moreover, Official ESLint plugin for Vue.js is included for heavy consistent code through all components vue files.

TODO

  • Inclusion of unit/featured/browser tests (stand by for now)

License

This project is open-sourced software licensed under the MIT license.

adr1enbe4udou1n/laravel-boilerplate 适用场景与选型建议

adr1enbe4udou1n/laravel-boilerplate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.91k 次下载、GitHub Stars 达 255, 最近一次更新时间为 2016 年 12 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「boilerplate」 「laravel」 「AdminLTE」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 adr1enbe4udou1n/laravel-boilerplate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 adr1enbe4udou1n/laravel-boilerplate 我们能提供哪些服务?
定制开发 / 二次开发

基于 adr1enbe4udou1n/laravel-boilerplate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 255
  • Watchers: 30
  • Forks: 103
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-04