流明和Laravel之间的异同 [英] Differences and Similarities Between Lumen and Laravel

查看:58
本文介绍了流明和Laravel之间的异同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了文档,看来Lumen是Laravel,功能较少.我肯定错过了什么. 我正在寻找Laravel和Lumen的组件和功能的对照表.有人知道差异吗?

I read the documentation and it seems Lumen is Laravel with less features. I must be missing something. I am looking for a comparison table of the components and features of both Laravel and Lumen. Does anyone know the differences?

推荐答案

更新(5.2)

在最新版本的流明(5.2)中,微框架专注于无状态API.
文档指出:

Update (5.2)

With the latest version of Lumen (5.2) the Microframework focuses on Stateless APIs.
The documentation states:

Lumen 5.2代表了精简Lumen的转变,它仅专注于提供无状态的JSON API. 因此,会话和视图不再包含在框架中.如果您需要访问这些功能,则应使用完整的Laravel框架.

Lumen 5.2 represents a shift on slimming Lumen to focus solely on serving stateless, JSON APIs. As such, sessions and views are no longer included with the framework. If you need access to these features, you should use the full Laravel framework.


原始答案(< == 5.1)

流明完全取决于速度.它比Laravel更快,并且每秒可以处理更多请求.


Original answer (<= 5.1)

Lumen is all about speed. It's faster and can handle more requests per second than Laravel.

Laravel是一个将许多组件(第三方和Laravel自己的组件)粘合在一起的框架.现在,Lumen使用了许多相同的组件,但将引导过程降至最低.您可以说这是一种不同的胶水",其组件(以及许多功能)大部分都相同.

Laravel is a framework that glues together a lot of components (3rd party and Laravels own components). Now Lumen makes use of a lot of the same components, but strips down the bootstrapping process to a minimum. You could say it is a "different glue", the components (and therefore a lot of the features) are mostly the same.

通过在配置方面取消框架的某些灵活性并更改默认的引导过程,可以实现性能提高.

The performance improvement is achieved by taking away some of the flexibility of the framework in terms of configuration and altering the default boot process.

此外,更多功能默认情况下处于禁用状态,必须先激活才能使用.例如:外观(如DB::table())
您首先需要在bootstrap/app.php中取消注释此行以启用它们:

Besides that, more features are disabled by default and have to be activated before they can be used. As an example: Facades (like DB::table())
You first need to uncomment this line in bootstrap/app.php to enable them:

// $app->withFacades();

Dotenv环境文件和Eloquent也是如此.

The same goes for Dotenv environment files and Eloquent.

对于路由,Lumen使用 nikic/FastRoute 代替symfonys路由器,因为它的性能要好得多,并且使微框架具有更大的优势增强.

For routing Lumen uses nikic/FastRoute instead of symfonys router because it performs a lot better and gives the micro-framework another big boost.

除此以外,其他一切都与Laravel中的内容相同.

Other than that pretty much everything is the same as in Laravel.

关于流明的好书

  • Documentation (especially the introduction)
  • Article from Matt Stauffer
  • Interview with Taylor Otwell (especially the last question)
  • Reddit discussion
  • Laracast: Introducing Lumen

这篇关于流明和Laravel之间的异同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆