Download the PHP package leftsky/laravel-api-key without Composer

On this page you can find all versions of the php package leftsky/laravel-api-key. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-key

Laravel API Key

Laravel API Key 是一个简单易用的 Laravel 包,用于管理和验证 API 密钥。通过这个包,您可以轻松地为您的 API 添加基于密钥的认证,并提供开箱即用的Filament管理界面。

版本兼容性

包版本 Laravel版本 PHP版本
1.0.1 12.x 8.2+

特性

屏幕截图

管理界面(已内置实现): API密钥管理界面

安装

使用 Composer 安装:

安装后发布配置文件:

运行迁移创建API密钥表:

基本用法

生成 API 密钥

使用命令行:

或者使用 Facade:

保护 API 路由

在路由中使用中间件保护您的 API:

启用 API 调用日志(新增)

要记录 API 调用日志,只需添加 api.log 中间件:

清理过期日志:

在请求中使用 API 密钥

在 API 请求中,在头信息中包含您的 API 密钥:

Filament管理界面

本包自动集成到Filament管理面板中,提供完整的API密钥管理界面和API调用日志查看界面。

如果你还没有安装Filament,可以参考Filament文档进行安装。

配置

您可以在 config/api_key.php 中配置:

缓存策略

为了提高性能,您可以使用缓存策略:

这将减少数据库查询,提高 API 响应速度。

自定义

修改API密钥的验证逻辑

可以通过扩展VerifyApiKey中间件来自定义验证逻辑:

然后在app/Http/Kernel.php中替换原中间件:

自定义API日志记录

类似地,您可以扩展ApiKeyLoggingMiddleware中间件来自定义日志记录逻辑:

然后在app/Http/Kernel.php中替换原中间件:

贡献

欢迎贡献代码、报告问题或提出改进建议!

许可证

本包基于 MIT 许可证 授权。


All versions of laravel-api-key with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0
illuminate/database Version ^12.0
illuminate/http Version ^12.0
filament/forms Version ^3.0
filament/tables Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package leftsky/laravel-api-key contains the following files

Loading the files please wait ....