承接 usmonaliyev/env-auth 相关项目开发

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

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

usmonaliyev/env-auth

最新稳定版本:1.1.0

Composer 安装命令:

composer require usmonaliyev/env-auth

包简介

The package provides middleware for Laravel applications to handle Basic Authentication and Secret Key Authentication using credentials stored in the .env file.

README 文档

README

Packagist Dependency Version Total Downloads Latest Version on Packagist Packagist License

The package provides middleware for Laravel applications to handle Basic Authentication and Secret Key Authentication using credentials stored in the .env file.

Installation

You can install the package via composer:

composer require usmonaliyev/env-auth

Publish

Publish the package configuration:

php artisan vendor:publish --provider="Usmonaliyev\EnvAuth\EnvAuthServiceProvider"

Configuration

Add the necessary credentials to your .env file.

If you want to modify keys of variables, you need to change config/env-auth.php after publish config file.

For BasicEnv middleware:

BASIC_USERNAME=your-username
BASIC_PASSWORD=your-password

For SecretEnv middleware:

AUTH_SECRET_KEY=your-secret-key

Usage

Register middleware

If you are using Laravel 11.x check out this link: https://laravel.com/docs/11.x/middleware#middleware-aliases

In your Laravel application's app/Http/Kernel.php file, register the new middleware classes:

protected $routeMiddleware = [
    // Other middleware
    'basic.env' => \Usmonaliyev\EnvAuth\Middleware\BasicEnv::class,
    'secret.env' => \Usmonaliyev\EnvAuth\Middleware\SecretEnv::class,
];

Protect routes

Apply the middleware to your routes in routes/web.php or routes/api.php.

Route::middleware('basic.env')->group(function () {

    ...
});

Testing

Use the following cURL command to test Basic Authentication:

curl -u your-username:your-password http://your-app-url/basic-protected-route

Contributing

Please see CONTRIBUTING for details.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固