编辑“︁
Laravel
”︁(章节)
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
== 功能 == 以下幾點為 Laravel 的核心設計理念<ref>其餘未具體指出的,可以參考 Laravel 3 技術文件的功能敘述:{{Cite web|url=http://code.tutsplus.com/tutorials/why-laravel-is-taking-the-php-community-by-storm--pre-52639|title=Why Laravel is Taking the PHP Community by Storm|accessdate=2015-05-09|author=Jeffrey Way|date=2012-11-28|archive-date=2015-05-05|archive-url=https://web.archive.org/web/20150505001943/http://code.tutsplus.com/tutorials/why-laravel-is-taking-the-php-community-by-storm--pre-52639|dead-url=no}}</ref> *'''Eloquent ORM''' ([[对象关系映射|物件關係對映]]):將 [[Active Record|Active Record 模式]] 以 PHP 實作,提供一些函式來建立 [[資料庫]] 物件之間的關聯。 依照 Active Record 模式的原則,Eloquent ORM 以 [[类 (计算机科学)|類別]] 代表 [[資料表]],並將這些類別的物件實例與資料表中的單一筆資料做綁定。<ref>{{Cite web|url=http://www.enukesoftware.com/blog/eloquent-orm-in-laravel-what-and-why|title=Eloquent ORM in Laravel: What and Why!|accessdate=2014-12-19|archive-url=https://web.archive.org/web/20141219144311/http://www.enukesoftware.com/blog/eloquent-orm-in-laravel-what-and-why/|archive-date=2014-12-19|dead-url=yes}}</ref><ref>{{Cite web|url=http://www.developer.com/lang/php/develop-faster-with-the-laravel-php-framework.html|title=Develop Faster with the Laravel PHP Framework|accessdate=2015-04-17|archive-date=2020-12-03|archive-url=https://web.archive.org/web/20201203172615/https://www.developer.com/lang/php/develop-faster-with-the-laravel-php-framework.html|dead-url=no}}</ref> * '''Query builder''':於 Laravel 3 釋出,提供一個能更直接的存取 Eloquent ORM 的管道。 與其撰寫 [[查询 (SQL)|SQL 查詢語法]],Laravel 的 query builder 提供了一系列的類別與 [[方法 (電腦科學)|函式]],得以使用程式化呼叫的方式來執行 SQL 查詢。 同時也可以對查詢語法的執行結果做(可再被查詢的)快取。<ref>{{Cite web|url=http://laravel.com/docs/4.0/queries|title=Laravel documentation (version 4.0): Query builder|accessdate=2015-04-27|archive-url=https://web.archive.org/web/20150324070108/http://laravel.com/docs/4.0/queries|archive-date=2015-03-24|dead-url=yes}}</ref> * '''Application logic''':在專案中將其他已開發的功能整合,顯著的案例為 Controller 的使用與路由的宣告。 其語法與 Sinatra 框架相似。 * '''Reverse routing''':為專案內的超連結建立成一個一個的路由,當套用了路由的超連結被修改,便會自動更新所有使用了該路由的超連結。 使用時需要填入要使用的路由的名稱,Laravel 會將他們轉換成對應的 [[统一资源标志符|URIs]]。 * '''Restful controllers''':提供一種將 [[超文本传输协议|HTTP GET]] 和 POST requests 背後的邏輯切割的方式。 * '''Class auto loading''':自動載入 PHP 的類別,不須手動維護所有類別的引用路徑。類別只會在被使用到的當下才載入,避免載入不須要的類別。 * '''[[MVC|View]] composers''':是可自定義的一些程式碼區塊,當 view 被載入時便會被執行。 <!--- * ''Blade'' templating engine combines one or more templates with a [[数据模型|data model]] to produce resulting views, doing that by [[源代码至源代码编译器|transpiling]] the templates into cached PHP code for improved performance. Blade also provides a set of its own [[控制流程|control structures]] such as [[條件運算式|conditional statements]] and loops, which are internally mapped to their PHP counterparts. Furthermore, Laravel services may be called from Blade templates, and the templating engine itself can be extended with custom directives.<ref>{{Cite web|url=http://laravel.com/docs/5.1/blade|title=Laravel documentation (version 5.1): Blade Templates|accessdate=2015-06-10|author=Dayle Rees|year=2014}}</ref><ref>{{Cite web|url=http://daylerees.com/codebright/blade|title=Laravel Blade engine|accessdate=2015-06-10|author=Dayle Rees|year=2014}}</ref> * ''IoC containers'' make it possible for new objects to be generated by following the [[控制反转|inversion of control]] (IoC) principle, in which the framework calls into the application- or task-specific code, with optional instantiating and referencing of new objects as [[单例模式|singletons]]. * ''Migrations'' provide a [[版本控制|version control]] system for database schemas, making it possible to associate changes in the application's codebase and required changes in the database layout. As a result, this feature simplifies the [[软件部署|deployment]] and updating of Laravel-based applications.<ref name="docs-migrations">{{Cite web|url=http://laravel.com/docs/5.0/migrations|title=Laravel documentation (version 5.0): Migrations and seeding|accessdate={{date|2015-04-27|mdy}}}}</ref> * ''Automatic pagination'' simplifies the task of implementing pagination, replacing the usual manual implementation approaches with automated methods integrated into Laravel. * ''Form request'' is a feature of Laravel 5 that serves as the base for [[Web Forms|form]] input validation by internally binding event listeners, resulting in automated invoking of the form validation methods and generation of the actual form.<ref>{{Cite web|url=https://www.tisindia.com/blog/laravel-best-php-framework-2015/|title=Creating a Contact Form in Laravel 5 Using the Form Request Feature!|accessdate={{date|2015-03-02|mdy}}|author=Manmeet Anand}}</ref> --> * '''Database seeding''':提供一種管道來把預設的資料用來填充到資料庫,便於進行[[软件测试]],或被作為應用程式最初的建置步驟。<ref>{{cite web |url= https://aquatecinnovative.com/laravel-development-services/ |title= Laravel Development Services |author= Sahil Sharma |publisher= Aquatec Innovative Private Limited |access-date= 2022-09-09 |archive-date= 2022-12-06 |archive-url= https://web.archive.org/web/20221206173609/https://aquatecinnovative.com/laravel-development-services/ |dead-url= no }}</ref> * '''Filesystem''':於 Laravel 5.0 新增,統一了 [[文件系统|檔案系統]] 的函式,讓本地端和 [[雲端運算|雲端]] 儲存空間(如 [[Amazon S3|亞馬遜 S3]]、[[Rackspace Cloud]])的操作邏輯一致。<ref>{{cite web |url=https://laravel.com/docs/master/filesystem |title=File Storage - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-29 |archive-url=https://web.archive.org/web/20201129005830/https://laravel.com/docs/master/filesystem |dead-url=no }}</ref> * '''[[单元测试]]''' 也被整合到了 Laravel,其包括的測試案例能夠偵測並預防框架內的[[迴歸]],並可以使用 Artisan CLI 來執行單元測試. * '''Homestead''': 一個[[Vagrant]][[虛擬機器|虛擬機]],預載了 Laravel 開發者需要的所有開發工具,包括 [[Ubuntu]],Gulp,Bower 以及其他輔助網頁開發的工具。<ref>{{Anchor|CASHIER|FLYSYSTEM|SOCIALITE}}</ref> * '''Lazy Collection''':於 Laravel 6 新增,使用 [[PHP]] 的 generators 來處理大量資料,同時保持較低的內存使用率。<ref>{{Cite web|url=https://laravel.com/docs/6.x/collections#lazy-collections|title=Collections - Laravel - The PHP Framework For Web Artisans|access-date=28 February 2020|archive-date=2020-11-12|archive-url=https://web.archive.org/web/20201112025518/https://laravel.com/docs/6.x/collections#lazy-collections|dead-url=no}}</ref> === 官方提供的套件 === 可透過 Composer 以及 Packagist 安裝下列套件: * '''Cashier''':於 Laravel 4.2 推出,可串接訂閱制付款服務如 [[Stripe]],並提供 [[优惠券]] 和 [[发票|收據]] 等功能。<ref>{{cite web |url=https://laravel.com/docs/master/billing |title=Laravel Cashier - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-10-30 |archive-url=https://web.archive.org/web/20201030162538/https://laravel.com/docs/master/billing |dead-url=no }}</ref> * '''Envoy''':於 Laravel 4.2 推出,提供了簡潔、輕量的語法,定義遠程服務器上運行的常見任務,使用 Blade 風格的語法,可以簡單的設置部署任務、執行 Artisan 指令等。<ref>{{cite web |url=https://laravel.com/docs/master/envoy |title=Laravel Envoy - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2021-01-10 |archive-url=https://web.archive.org/web/20210110145719/https://laravel.com/docs/master/envoy/ |dead-url=no }}</ref> * '''Socialite''':於 Laravel 5.0 推出,簡化串接 [[开放授权|OAuth]] 的流程,提供平台如 [[Facebook]]、[[Twitter]]、[[Google]]、[[GitHub]] 和 [[Bitbucket]]。<ref>{{cite web |url=https://laravel.com/docs/master/socialite |title=Laravel Socialite - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-23 |archive-url=https://web.archive.org/web/20201123225227/https://laravel.com/docs/master/socialite |dead-url=no }}</ref> * '''Passport''':於 Laravel 5.3 推出,完整的 [[开放授权|OAuth2]] 服務器實現。<ref>{{cite web |url=https://laravel.com/docs/master/passport |title=Laravel Passport - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-12 |archive-url=https://web.archive.org/web/20201112003632/https://laravel.com/docs/master/passport |dead-url=no }}</ref> * '''Scout''':於 Laravel 5.3 推出,Eloquent 全文搜尋套件,預設使用 [[Algolia]] 驅動。<ref>{{cite web |url=https://laravel.com/docs/master/scout |title=Laravel Scout - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-29 |archive-url=https://web.archive.org/web/20201129021143/https://laravel.com/docs/master/scout |dead-url=no }}</ref> * '''Dusk''':於 Laravel 5.4 推出,易於使用的瀏覽器自動化測試套件。<ref>{{cite web |url=https://laravel.com/docs/master/dusk |title=Laravel Dusk - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-29 |archive-url=https://web.archive.org/web/20201129015358/https://laravel.com/docs/master/dusk |dead-url=no }}</ref> * '''Horizon''':於 Laravel 5.5 推出,以 [[Redis]] 為基礎的 Laravel 隊列儀表板和設定系統。<ref>{{cite web |url=https://laravel.com/docs/master/horizon |title=Laravel Horizon - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-23 |archive-url=https://web.archive.org/web/20201123225136/https://laravel.com/docs/master/horizon |dead-url=no }}</ref> * '''Telescope''':於 Laravel 5.7 推出,提供簡潔的儀表板,監控應用程式的請求(Request)、異常(Exception)、日誌(Log)、資料庫查詢(Database queries)、排隊的作業(Queued jobs)、郵件(Mail)、通知(Notifications)、緩存操作、計劃任務(Notifications)、變量監控(variable dumps)等。<ref>{{cite web |url=https://laravel.com/docs/master/telescope |title=Laravel Telescope - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-29 |archive-url=https://web.archive.org/web/20201129011814/https://laravel.com/docs/master/telescope |dead-url=no }}</ref> * '''Sanctum''':於 Laravel 7.0 推出,為[[單頁應用]]、[[移動應用程序]]和基於令牌的簡單API,提供了輕巧的身份驗證系統。<ref>{{cite web |url=https://laravel.com/docs/master/sanctum |title=Laravel Sanctum - Laravel - The PHP Framework For Web Artisans |publisher=laravel.com |accessdate=February 28, 2020 |archive-date=2020-11-23 |archive-url=https://web.archive.org/web/20201123223853/https://laravel.com/docs/master/sanctum |dead-url=no }}</ref> === Artisan CLI === Laravel 的 [[命令行界面|命令列介面]] (CLI),稱為 ''Artisan'',於 Laravel 3 推出時功能還相當有限。 隨後 Laravel 將架構改為以 [[Composer]] 作為基底,讓 Artisan 得以和 [[Symfony]] 框架的元件互補,也因此 Laravel 4 的 Artisan 提供了更多的功能。<ref>{{Cite web | url = http://code.tutsplus.com/tutorials/your-one-stop-guide-to-laravel-commands--net-30349 | title = Your One-Stop Guide to Laravel Commands | date = 2013-02-28 | accessdate = 2015-05-09 | author = Jason Lewis | website = code.tutsplus.com | archive-date = 2015-05-18 | archive-url = https://web.archive.org/web/20150518024938/http://code.tutsplus.com/tutorials/your-one-stop-guide-to-laravel-commands--net-30349 | dead-url = no }}</ref> Artisan 的功能被分散到不同的子命令,用以協助打造與管理這些由 Laravel 建構而成的軟體。最常見的使用情境如:操作資料庫的 migration & seeding、汲取套件的靜態資源、為新建立的 controller 或 migration 產生程式碼樣板(為開發者省去重複撰寫相同程式碼的時間)。開發者也可以自行新增新的命令,來擴充 Artisan 的功能(如自動化的執行任務)。<ref name="packt-getting-started" />
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
页面
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息