Laravel 5软件包开发的清晰性 [英] Laravel 5 package development clarity
问题描述
我已经在网上阅读了一些有关软件包开发的文章,但是无法完全理解基本设置.我已经用发布的版本编写了jQuery插件,并通过了发行版发布给Bower,所以也许我只是不了解Laravel的区别.
Ive been reading a few articles on the net about package development but cant quite wrap my head around the basic setup. Ive written jQuery plugins with releases and published to Bower in the passed so maybe im just not understanding the difference with Laravel.
使用jQuery插件开发人员,我只会通过bower.json排除我的开发人员所需的依赖关系,以防止有人获取我的依赖关系.似乎使用Laravel您创建了一个未跟踪的Laravel框架文件夹,并将您的软件包放入vendor文件夹中,并且仅使用Git进行了跟踪?因此,基本上位于我的供应商软件包之外的Laravel项目只是我PC上的一些文件?当然,我想跟踪该软件包所开发的Laravel版本吗?
With jQuery plugin dev I would just exclude my dev required dependancies through bower.json to prevent a person pulling in my dependancies. It seems that with Laravel u create an un-tracked Laravel framework folder and put your package into the vendor folder and track only that with Git? So basically the Laravel project sitting outside of my vendor package is just some files on my PC? Surely I would want to track which version of Laravel the package was developed on?
或者我应该创建一个基础" Laravel存储库并在vendor文件夹内创建另一个存储库,以确保我知道该程序包是基于哪个Laravel构建的?
OR should I create a "base" Laravel repository and create another repository inside the vendor folder so make sure I know which Laravel the package was built on?
文档和教程非常模糊...
Documentation and tutorials are very vague...
推荐答案
您的问题看起来有些混乱.我为Laravel开发软件包,以下是常规方法:
Your question looks a little bit confuse. I develop packages for Laravel and the following is a regular way:
- Laravel通过作曲家管理其依赖关系,查看
composer.json
以了解使用bower
的相似之处. - 为了使您的软件包与laravel的核心兼容,您需要在软件包中实现一些接口.该软件包还可以通过composer管理依赖关系.
- 可以在不同版本的控件中将软件包创建为存储库,例如Github,BitBucket,Packagist,Catalyst,私有软件包存储库等.默认情况下,laravel从Packagist中提取软件包,但是在composer.json文件中,您可以指定另一个存储库根据需要.
- 当您触发
composer update
(与bower update
等效)时,此依赖项管理器将提取所有软件包并将其自动下载到vendor/
目录中.
- Laravel manage its dependencias via composer, take a look into
composer.json
to get a clue how similiar is withbower
. - In order to get yout package compatible with laravel's core you need to implement some interfaces in your package. This package also can manage dependencies via composer.
- A package can be created as a repository in different version controls, like Github, BitBucket, Packagist, Cartalyst, private packages repositories, etc. By default laravel pull packages from Packagist, but into composer.json file you can specify another reposository as needed.
- When you trigger
composer update
(this is an equivalent asbower update
), this dependencies manager will pull all the packages and download them automatically invendor/
directory.
在使用laravel测试时如何编码您的软件包?包括我在内的某些人会做以下事情:
How to code your package while testing with laravel? some people do the following, including me:
- 仅出于软件包开发目的安装laravel实例.
- 根据lavavel的软件包要求,在
vendor/project-name
内创建一个新项目(您的软件包项目). - 从此项目位置继续处理您的软件包.这样,更改立即反映在laravel安装中.
- 别忘了提交并推动
- Install a laravel instance just for package development purpose.
- Create a new project (your package project) inside of
vendor/project-name
following lavavel's package requirements. - Keep working your package from this project location. By this way the changes are reflecting instantly in laravel installation.
- Don't forget to commit and push
这篇关于Laravel 5软件包开发的清晰性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!