owenoj/underconstruction
Composer 安装命令:
composer require owenoj/underconstruction
包简介
README 文档
README
This Laravel package makes it possible to set your website in "Under Construction" mode. Only users with the correct 4 digit code can access your site. This package can for example be useful to show your website to a specific client. Everything works out of the box, and it's fully customizable.
If you appreciate my work please give this repo a star or buy me a coffee ^ 🤗.
Installation
Begin by installing this package through Composer (Laravel 6, 7, 8, 9 and 10 compatible!).
composer require larsjanssen6/underconstruction
The \LarsJanssen\UnderConstruction\UnderConstruction::class middleware must be registered in the kernel:
//app/Http/Kernel.php protected $routeMiddleware = [ // ... 'under-construction' => \LarsJanssen\UnderConstruction\UnderConstruction::class, ];
Defaults
Publish the default configuration file.
php artisan vendor:publish # Or... php artisan vendor:publish --provider="LarsJanssen\UnderConstruction\UnderConstructionServiceProvider"
This package is fully customizable. This is the content of the published config file under-construction.php:
<?php return [ /* * Activate under construction mode. */ 'enabled' => env('UNDER_CONSTRUCTION_ENABLED', true), /* * Hash for the current pin code */ 'hash' => env('UNDER_CONSTRUCTION_HASH', null), /* * Under construction title. */ 'title' => 'Under Construction', /* * Custom Route Prefix * */ 'route-prefix' => env('UNDER_CONSTRUCTION_ROUTE_PREFIX','under'), /* * Custom Endpoint if you don't want to use 'construction' * e.g. if you change to 'checkpoint', the route prefix * above will be appended giving you 'under/checkpoint' * */ 'custom-endpoint' => env('UNDER_CONSTRUCTION_CUSTOM_ENDPOINT','construction'), /* * Back button translation. */ 'back-button' => 'back', /* * Show button translation. */ 'show-button' => 'show', /* * Hide button translation. */ 'hide-button' => 'hide', /* * Show loader. */ 'show-loader' => true, /* * Redirect url after a successful login. */ 'redirect-url' => '/', /* * Enable throttle (max login attempts). */ 'throttle' => true, /* |-------------------------------------------------------------------------- | Throttle settings (only when throttle is true) |-------------------------------------------------------------------------- | */ /* * Set the amount of digits (max 6). */ 'total_digits' => 4, /* * Set the maximum number of attempts to allow. */ 'max_attempts' => 3, /* * Show attempts left. */ 'show_attempts_left' => true, /* * Attempts left message. */ 'attempts_message' => 'Attempts left: %i', /* * Too many attempts message. */ 'seconds_message' => 'Too many attempts please try again in %i seconds.', /* * Set the number of minutes to disable login. */ 'decay_minutes' => 5, /* * Prevent the site from being indexed by Robots when locked */ 'lock_robots' => true, ];
Usage
You'll have to set a 4 digit code (you can change this up to 6 in config file). You can do that by running this custom
artisan command (in this example the code is 1234 ,you can obviously set another code). It
will generate a hash that will be stored in your .env file.
php artisan code:set 1234
You can set routes to be in "Under Construction" mode by using the under-construction-middleware on them.
Route::group(['middleware' => 'under-construction'], function () { Route::get('/live-site', function() { echo 'content!'; }); });
Changelog
Please see CHANGELOG for more information on what has changed recently.
Testing
composer test
Contributing
I would love to hear your ideas to improve my codeing style and conventions. Feel free to contribute.
Security
If you discover any security related issues, please email larsjanssen64@gmail.com. You can also make an issue.
Credits
About me
I'm Lars Janssen from The Netherlands and like to work on web projects. You can follow me on Twitter.
License
The MIT License (MIT). Please see License File for more information.
❤️ Open-Source Software - Give ⭐️
We have included the awesome symfony/thanks composer package as a dev
dependency. Let your OS package maintainers know you appreciate them by starring
the packages you use. Simply run composer thanks after installing this package.
(And not to worry, since it's a dev-dependency it won't be installed in your
live environment.)
owenoj/underconstruction 适用场景与选型建议
owenoj/underconstruction 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 owenoj/underconstruction 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 owenoj/underconstruction 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-16
