laravel/database

为您的非Laravel项目获取Laravel数据库。基于 illuminate/database 构建,提供迁移、种子和Artisan支持

安装次数: 31 827

依赖者: 2

建议者: 0

安全性: 0

星级: 85

关注者: 8

分支: 12

开放问题: 4

类型:项目

8.83.0 2022-02-14 02:20 UTC

This package is auto-updated.

Last update: 2024-09-20 16:08:17 UTC


README

为您的非Laravel项目提供完整的Laravel数据库功能,为 Illuminate Database 添加迁移、种子和Artisan支持。

它使 artisan 命令行工具与

Available commands:

  db                Start a new database CLI session
  dump-autoload     Regenerate framework autoload files
  env               Display the current framework environment
  help              Display help for a command
  inspire           Display an inspiring quote
  list              List commands
  migrate           Run the database migrations
  serve             Serve the application on the PHP development server
  tinker            Interact with your application
  
db
  db:seed           Seed the database with records
  db:wipe           Drop all tables, views, and types

make
  make:command      Create a new Artisan command
  make:controller   Create a new controller class
  make:factory      Create a new model factory
  make:migration    Create a new migration file
  make:model        Create a new Eloquent model class
  make:seeder       Create a new seeder class
  
migrate
  migrate:fresh     Drop all tables and re-run all migrations
  migrate:install   Create the migration repository
  migrate:refresh   Reset and re-run all migrations
  migrate:reset     Rollback all database migrations
  migrate:rollback  Rollback the last database migration
  migrate:status    Show the status of each migration
  
vendor
  vendor:publish    Publish any publishable assets from vendor packages

Laravel 是一个具有表达性、优雅语法的Web应用框架。我们从其中提取了数据库功能,使其可用于其他框架。

Illuminate Database 组件是一个完整的PHP数据库工具包,提供表达性查询构建器、ActiveRecord风格ORM和架构构建器。它目前支持MySQL、Postgres、MSSQL Server和SQLite。我们将它与 Illuminate FileSystem 和 Illuminate Console 结合起来,使Artisan能够与数据库相关命令一起工作。

安装

安装Composer

Laravel Database 使用 Composer 管理其依赖关系。首先,下载一个 composer.phar 的副本。一旦您有了PHAR存档,您可以将它保留在本地项目目录中,或者将其移动到 usr/local/bin 以在系统上全局使用。在Windows上,您可以使用Composer的 Windows安装程序

安装Laravel Database

在您的终端中运行Composer create-project命令来安装Laravel Database

composer create-project laravel/database --prefer-dist

使用说明

从您的公共 index.php 文件中,在 bootstrap 文件夹中包含 autoload.php,这内部使用Composer自动加载器。这启用了所有db相关类的懒加载。它不会启动数据库引擎,直到您调用DB相关类之一。

添加更多组件

有关如何添加更多Laravel组件或兼容的第三方服务提供商等的说明,请阅读 app/config/app.php 文件中的注释

实用用法示例

官方文档

整个框架的文档可以在 Laravel网站 上找到。从那里参考所有数据库相关部分。

致谢

Laravel Database的所有荣誉都属于Laravel框架的开发者。我们只是在这里将这些组件组合起来

贡献

有关此集成的问题和拉取请求应提交到 laravel/database 存储库。

许可证

Laravel Database是开源软件,许可协议为 MIT许可证