tt作曲家简谱打谱软件

Since its release on March 1st, 2012 Composer has gained widespread popularity for bringing something to PHP which was sorely needed: dependency management. Composer is essentially a way to pull in all the third party software such as CSS frameworks, jQuery plugins and others into your project.

自2012年3月1日发布以来,Composer因将PHP迫切需要的东西:依赖项管理而广受欢迎。 实际上,Composer是将所有第三方软件(例如CSS框架,jQuery插件等)引入您的项目的一种方法。

I'm sure there are plenty of coders out there who are wondering about the benefits of using composer and many who are afraid to make the leap into a new system. In this article we'll take a look at what exactly Composer is, what it does and why it is a great tool for PHP projects.

我敢肯定,现在有很多编码人员对使用作曲家的好处感到疑惑,还有许多人害怕进入新系统。 在本文中,我们将了解Composer的确切含义,功能以及为什么它是PHP项目的绝佳工具。

First we'll take a broader scope look at dependency management and then install composer. We'll take a general look at usage and then flesh out some of the basics. Let's get started!

首先,我们将更广泛地研究依赖关系管理,然后安装composer。 我们将大致了解用法,然后充实一些基础知识。 让我们开始吧!

什么是依赖管理? (What Is Dependency Management?)

Dependency management is actually a pretty simple concept. Let's assume you're creating a one-page website using the Foundation framework for your Javascript and CSS needs. How do you make sure that Foundation is added to your project?

依赖管理实际上是一个非常简单的概念。 假设您要使用Foundation框架创建一个单页网站来满足Javascript和CSS的需求。 您如何确保将Foundation添加到您的项目中?

The usual approach is to go to the website, download the package and place it somewhere within your project. So far so good. Now, what do you do when you want to update to the latest version? You repeat the same thing, overwriting the old version.

通常的方法是访问网站,下载软件包并将其放在项目中的某个位置。 到目前为止,一切都很好。 现在,当您想更新到最新版本时该怎么办? 您重复同样的事情,覆盖旧版本。

Let's assume this goes on for a while and you realize something is broken. They've changed something in Foundation and now you have to roll back, but where to? You'll need to find the older versions and start applying them until you find the right one.

假设这种情况持续了一段时间,您发现有些东西坏了。 他们改变了Foundation的某些内容,现在您必须回滚,但是要去哪里呢? 您需要找到较旧的版本并开始应用它们,直到找到合适的版本为止。

Even if you sort all that out, let's say you move onto someone else's project. Are they using Foundation as well? If so, where is it installed and what version is it?

即使您将所有内容整理了出来,也可以说您进入了其他人的项目。 他们也在使用Foundation吗? 如果是这样,它在哪里安装以及什么版本?

These may not seem like huge issues for a small project but imagine a project with 8-10 dependencies - which still isn't a lot. Managing everything modularly becomes impossible or - at the very least - a waste of time.

对于一个小型项目来说,这些问题似乎不是很大的问题,但是可以想象一个依赖项为8-10的项目-仍然不是很多。 模块化管理所有内容成为不可能,或者至少是浪费时间。

Dependency management solves these problems by automating and standardizing. The retrieval of dependencies such as Foundation, jQuery, Twig, Symphony, logging modules and so on can be done programmatically. Preferred versions can also be designated which protects against conflicts.

依赖管理通过自动化标准化解决了这些问题。 可以以编程方式完成对诸如Foundation,jQuery,Twig,Symphony,日志记录模块等依赖项的检索。 还可以指定首选版本,以防止冲突。

@media (max-width: 1280px) { .go-go-gadget-react img:first-child { display: none; } }@media (max-width: 780px) {.go-go-gadget-react { flex-direction: column; }.go-go-gadget-react img { margin-left: 0 !important; margin-bottom: 12px !important; }.header-thingy { margin-top: 20px; }.button-thingy { margin-left: 0 !important; margin-top: 12px !important; }} @media (max-width: 1280px) { .go-go-gadget-react img:first-child { display: none; } }@media (max-width: 780px) {.go-go-gadget-react { flex-direction: column; }.go-go-gadget-react img { margin-left: 0 !important; margin-bottom: 12px !important; }.header-thingy { margin-top: 20px; }.button-thingy { margin-left: 0 !important; margin-top: 12px !important; }}

A dependency manager standardizes the way the packages are stored and where they are used from. In practice this means that every project that uses the same dependency manager will follow the same structure - at least for dependencies.

依赖性管理器标准化了软件包的存储方式以及从何处使用软件包。 实际上,这意味着使用同一依赖项管理器的每个项目都将遵循相同的结构-至少对于依赖项而言。

安装作曲家 (Installing Composer)

Composer is available on any system you'd like. On Windows you should use the Composer Setup file which can be found on the Getting Started page. On Linux based systems, including OSX, you can use the following command to install it locally:

Composer在您想要的任何系统上都可用。 在Windows上,您应该使用Composer安装文件,该文件可在“ 入门”页面上找到。 在基于Linux的系统(包括OSX)上,可以使用以下命令在本地安装它:

curl -sS https://getcomposer.org/installer | php

Run the above command from your project directory. This will give you a composer.phar file which you can use in that directory. I prefer to install the command globally so I can use it in any folder I like. To make this happen, issue the following command as well:

从您的项目目录运行以上命令。 这将为您提供一个composer.phar文件,您可以在该目录中使用该文件。 我更喜欢全局安装该命令,以便可以在我喜欢的任何文件夹中使用它。 为此,还请发出以下命令:

mv composer.phar /usr/local/bin/composer

There are two things which could go wrong. If you need admin privileges here you will need to run this command with sudo.

有两件事可能出错。 如果您需要管理员权限,则需要使用sudo运行此命令。

mv composer.phar /usr/local/bin/composer

In Yosemite this command may fail because the usr directory doesn't exist. In this case, create the directory structure first and then move the file as usual.

在优胜美地,此命令可能会失败,因为usr目录不存在。 在这种情况下,请先创建目录结构,然后照常移动文件。

作曲家简介 (An Introduction To Composer)

There are two separate elements to dependency management with Composer. The first is Composer itself which is a command line tool for grabbing and managing dependencies. The second is Packagist - the main composer repository. This is where the packages you may want to use are stored.

使用Composer进行依赖项管理有两个单独的元素。 第一个是Composer本身,它是用于获取和管理依赖项的命令行工具。 第二个是Packagist-主要的作曲者资料库。 这是您可能要使用的软件包的存储位置。

When using Composer the heart of your dependency management will be a single JSON file named composer.json. The nuts and bolts look something like this:

使用Composer时,依赖项管理的核心将是一个名为composer.json JSON文件。 螺母和螺栓看起来像这样:

{"name": "danielpataki/my_project","description": "My New Project","authors": [{"name": "Daniel Pataki","email": "mail@mymail.com"}],"require": {"monolog/monolog": "1.12.0"}
}

The requirements of you project will be listed in the require section. In this case I've required Monolog, a popular framework for logging things. Just because I have a JSON file with this information doesn't mean I can start using Monolog. Here's where the command line comes in.

您的项目需求将在“ require部分列出。 在这种情况下,我需要Monolog ,这是一个用于记录事物的流行框架。 仅仅因为我有一个包含此信息的JSON文件,并不意味着我可以开始使用Monolog。 这是命令行输入的位置。

Using the terminal, in the project folder I issue the composer install command. This will bring all my dependencies into the project and do some other neat things.

使用终端,在项目文件夹中,发出composer install命令。 这会将我所有的依赖项带入项目,并做一些其他的整洁的事情。

A vendor directory has been created which should contain all dependencies - including composer itself. The screenshot also shows monolog and psr which is a dependency of monolog in addition to a composer.lock file.

已创建vendor目录,其中应包含所有依赖项-包括作曲家本身。 屏幕快照还显示了monolog和psr,除了composer.lock文件之外,psr也是monolog的依赖项。

At this point you can start using your dependencies but there is a lot more we can learn and do to be more efficient. Let's go step-by-step and learn a bit more about Composer.

在这一点上,你可以开始使用你的依赖,但还有很多我们可以学习和做更有效率。 让我们一步一步地学习有关Composer的更多信息。

指定版本 (Specifying Versions)

In our code above we wanted to retrieve version 1.12.0 specifically but there may be cases where we want to be a bit more forgiving. There are six ways to specify the version you want, let's look at them:

在上面的代码中,我们想专门检索版本1.12.0,但是在某些情况下,我们可能会更宽容一些。 有六种方法可以指定所需的版本,让我们看一下:

版本范围 (Version Range)

Using comparison operators you can grab version higher than 1.3, lower than 1.8 or follow an even more complex ruleset by using AND and OR logic. Operators used can be >, <, >=, <= and !=. AND logic is represented by a space or comma, OR logic is represented by double pipes: ||.

使用比较运算符,您可以使用AND和OR逻辑获取高于1.3,低于1.8的版本,或遵循甚至更复杂的规则集。 使用的运算符可以是><>=<=!= 。 AND逻辑用空格或逗号表示,或逻辑用双管道表示: ||

Specifying >2.7 would mean any version above 2.7. >2.7 <=3.5 would allow for any version above 2.7 right up until - and including - 3.5.

指定>2.7表示2.7以上的任何版本。 >2.7 <=3.5将允许2.7以上的任何版本,直到-包括-3.5。

通配符版本 (Wildcard Versions)

By using a wildcard you can specify a pattern. 2.3.* would be encompass everything above and including 2.3.0 and below - but not including - 2.4.0. It is equivalent to >=2.3.0 <2.4.

通过使用通配符,可以指定模式。 2.3.*将涵盖2.3.0及以下版本中的所有内容,但不包括2.4.0。 等效于>=2.3.0 <2.4

连字符范围 (Hyphen Ranges)

Hyphen ranges allow you to specify a range more easily, although it is a bit easier to get confused because of how it handles partial versions. A full version consists of three numbers in which case hyphen ranges make perfect sense.

连字符范围使您可以更轻松地指定范围,尽管由于它会处理部分版本而使它更容易混淆。 完整版本由三个数字组成,在这种情况下,连字符范围是很有意义的。

2.0.0 - 3.0.0 is an inclusive range which means that all versions above and including 2.0.0 and below and including 3.0.0 will be accepted.

2.0.0 - 3.0.0是一个包含范围,这意味着将接受高于2.0.0和低于2.0.0以及低于3.0.0的所有版本。

Partial versions like 2.0 - 3.0 means any version above - and including - 2.0 right up until but not including version 3.1.

部分版本(例如2.0 - 3.0表示高于-包括-2.0的任何版本,直到但不包括版本3.1。

The reason for this seemingly weird behaviour is that the left side is inclusive, the right side is completed with a wildcard. The expression above would be equivalent to >=2.1 <3.1.0

这种看似怪异的行为的原因是,左侧是包含在内的,右侧是使用通配符完成的。 上面的表达式等效于>=2.1 <3.1.0

蒂尔德山脉 (Tilde Range)

A tilde range is great for targeting a minimum required version and allowing anything up to, but not including, the next major release. If you specify ~3.6 you are allowing 3.6 and everything up to, but not including 4.0.

代字号范围非常适合定位最低要求的版本,并允许包含但不包括下一个主要版本的所有内容。 如果指定~3.6 ,则表示允许使用3.6及所有版本,但不包括4.0。

This method of specifying a version is equivalent to >-3.6 <4.0.

这种指定版本的方法等效于>-3.6 <4.0

插入范围 (Caret Range)

The caret range is meant to allow all non-breaking updates. If a project follows semantic versioning there shouldn't be any enhancements that break compatibility within a major branch. That is to say any thing above and including a major version and below and not including the next major version should be safe to use. By specifying ^3.3.5 you are allowing anything right up to, but not including, 4.0.

脱字号范围旨在允许所有不间断的更新。 如果项目遵循语义版本控制,则不应有任何破坏主要分支内兼容性的增强功能。 就是说,上面(包括主要版本)以及下面(不包括下一个主要版本)中的任何内容都应该可以安全使用。 通过指定^3.3.5您就可以允许但不包括4.0之前的所有内容。

开发大师 (Dev-Master)

By specifying dev-master you are grabbing the currently developed latest release which hasn't been tagged with a version number yet. This can be just fine while developing but you need to be aware that the potential for bugs is higher in these versions.

通过指定dev-master您可以获取当前开发的最新版本,但尚未标记版本号。 在开发过程中这可能很好,但是您需要意识到,在这些版本中,潜在的错误可能性更高。

锁定 (Locking)

Locking of dependencies is one of the most useful features of Composer. I mentioned the composer.lock file eariler. What this does is lock down the versions of the used components.

锁定依赖项是Composer最有用的功能之一。 我提到了composer.lock文件的耳环。 这样做是锁定所使用组件的版本。

The lock file can make sure that everyone works with the same versions of files. Just because the application shouldn't break due to a component update doesn't mean that all your teammates and your production server should all be running separate versions.

锁定文件可以确保每个人都可以使用相同版本的文件。 仅仅因为应用程序不应该由于组件更新而中断,并不意味着您的所有队友和生产服务器都应该运行单独的版本。

When you first use Composer to grab a dependency it writes the exact version to the lock file. If you specified 2.3.* and 2.3.5 is the latest version the installed version will be 2.3.5 and it will be entered into the lock file.

首次使用Composer来获取依赖项时,它会将确切的版本写入锁定文件。 如果您指定2.3.*和2.3.5为最新版本,则安装的版本将为2.3.5,并将其输入到锁定文件中。

Let's say a developer joins the team 10 days later. By this time the dependency has been updated to 2.3.6. If he uses the correct command (composer install) he will receive 2.3.5 because it is locked in place.

假设一名开发人员在10天后加入了该团队。 到此时,依赖项已更新为2.3.6。 如果他使用正确的命令( composer install ),他将收到2.3.5,因为它已锁定到位。

You can of course decide to update your dependencies. In this case you should run composer update. This will grab the latest versions allowed and write them to the lock file. This will then be distributed to all sources which can in turn be updated.

您当然可以决定更新您的依赖项。 在这种情况下,您应该运行composer update 。 这将获取允许的最新版本并将其写入锁定文件。 然后将其分发给所有源,这些源又可以更新。

发展要求 (Development Requirements)

Composer allows you to specify development requirements. This is done by specifying your requirements in the require-dev array instead of the require array.

Composer允许您指定开发要求。 这是通过在require-dev数组而不是require数组中指定需求来完成的。

{"name": "danielpataki/my_project","description": "My New Project","authors": [{"name": "Daniel Pataki","email": "mail@mymail.com"}],"require": {"monolog/monolog": "1.12.0"},"require-dev" : {"fzaninotto/faker", "dev-master"}
}

Faker is a PHP class that generates fake data. This is great for development but in production it reallt isn't required.

Faker是一个PHP类,可生成伪造数据。 这对开发非常有用,但在生产中则不需要。

Be aware that development requirements are always installed by default, Composer doesn't magically know when it is being run on your production server. If you want to exclude development requirements you will need to run the install or update command with the --no-dev option.

请注意,默认情况下始终会始终安装开发要求,因此Composer无法神奇地知道何时在生产服务器上运行它。 如果要排除开发需求,则需要使用--no-dev选项运行installupdate命令。

野外作曲家 (Composer In The Wild)

Composer is used everywhere in the PHP World. All large and well-known website components such as jQuery, Foundation, Bootstrap, even WordPress itself has a composer package available.

Composer在PHP世界中无处不在。 所有大型且知名的网站组件,例如jQuery,Foundation,Bootstrap,甚至WordPress本身都提供了composer软件包。

In addition, smaller but equally useful code can be retrieved via composer. Logging packages such as monolog, PHP mailers, string manipulation classes, PHP Unit and other tools also around.

此外,可以通过作曲者检索较小但同样有用的代码。 日志记录包,例如monolog,PHP邮件程序,字符串操作类,PHP Unit和其他工具也都在附近。

The framework community has benefited greatly from Composer's capability to unify project requirements. The much-adored Laravel, FuelPHP, Yii Framework and others rely on composer for bringing together shared functionality for projects.

框架社区从Composer统一项目需求的能力中受益匪浅。 备受推崇的Laravel , FuelPHP , Yii Framework和其他依赖于作曲家来为项目整合共享功能。

The biggest benefit is of course hidden from view. Composer is great when you need to share or deploy code. You don't need to lug around 20-50Mb of related but unused code. You can just check in the composer.json and lock files and everyone will be on the same page within minutes.

最大的好处当然是看不见了。 当您需要共享或部署代码时,Composer非常有用。 您不需要花费20-50Mb的相关但未使用的代码。 您只需签入composer.json并锁定文件,几分钟之内每个人都将位于同一页面上。

结论 (Conclusion)

There are many-many more things you can do with Composer but I hope I've given you a glimpse into its power. In addition to what we talked about, Composer gives you excellent autoloading out of the box, you can hook scripts into any step of the update processes and so on.

您可以使用Composer做更多的事情,但我希望我已经让您了解了它的强大功能。 除了我们所讨论的内容之外,Composer还为您提供了出色的即装即用功能,您可以将脚本挂接到更新过程的任何步骤中,依此类推。

Any group project should use Composer but it's pretty useful even if you work alone. It gives you a lot of flexibility and it future-proofs your project - you never know when you may need an extra hand with it!

任何小组项目都应使用Composer,但即使您一个人工作,它也非常有用。 它为您提供了很大的灵活性,并且可以使您的项目适应未来的发展-您永远不知道何时可能需要额外的帮助!

翻译自: https://scotch.io/tutorials/a-beginners-guide-to-composer

tt作曲家简谱打谱软件

tt作曲家简谱打谱软件_作曲家入门指南相关推荐

  1. tt作曲家简谱打谱软件_作曲家全球需求被认为有害吗?

    tt作曲家简谱打谱软件 We've discussed Composer best practices before, and I've always advocated using composer ...

  2. tt作曲家简谱打谱软件_掌握作曲家的技巧和窍门

    tt作曲家简谱打谱软件 Composer has revolutionized package management in PHP. It upped the reusability game and ...

  3. c++2个三维向量求角度差_交叉学科入门指南(2)——线性回归

    本文使用 Zhihu On VSCode 创作并发布 由于上一章的内容主要围绕编程实战展开(现在还在整合原稿第一章和附录,敬请期待),也就是说,这一章才是魔鬼数学的开始. 为什么把"线性回归 ...

  4. 像素/厘米与像素/英寸区别_像素/体素艺术入门指南

    像素/厘米与像素/英寸区别 Here's some resources I've found helpful so you can start learning pixel or voxel art ...

  5. 简明易懂的c#入门指南_统计假设检验的简明指南

    简明易懂的c#入门指南 介绍 (Introduction) One of the main applications of frequentist statistics is the comparis ...

  6. 数据分析从头学_数据新闻学入门指南:让我们从头开始构建故事

    数据分析从头学 by Mina Demian 由Mina Demian 数据新闻学入门指南:让我们从头开始构建故事 (A Beginner's Guide to Data Journalism: Le ...

  7. 编程指南_今晚7点,译者编程入门指南抽奖!

    各位关注"简言"的同学们好.老师们! 我的新书<译者编程入门指南>出版啦!感谢大家一直以来的支持和陪伴,我每次发完文章后都会得到大家的点赞.转发.留言甚至打赏,我感到非 ...

  8. 用python公众号开书城步骤_资源 | 开放Python书籍:一本短小精悍的初学者入门指南...

    资源 | 开放Python书籍:一本短小精悍的初学者入门指南 作者:机器之心 来源:机器之心 公众号 分享到: 03-25 选自GitHub机器之心整理 参与:思源 如何快速熟悉 Python 编程一 ...

  9. java 多模块项目 包路径冲突_多智能体仿真建模在交通中的应用|MATSim入门指南...

    点击蓝字|关注我们 无论是你是更侧重于工程实践还是更侧重于理论研究,交通仿真总是一个绕不开的话题.常用的交通仿真软件包括Vissim.Paramics.Anylogic.Transcad等等.近年来, ...

最新文章

  1. python绘图颜色代码_python matplotlib-颜色代码+ve和-ve值在绘图中
  2. usb 由于计算机限制,电脑usb被限制了怎么办
  3. .ini文件中的PHP 5.6 error_reporting设置不起作用
  4. 合格的Java程序员需要提升的能力有哪些
  5. python中字符串转xml对象_Python实现对象转换为xml的方法示例
  6. matlab迭代算法实例_【优化求解】基于NSGA2的求解多目标柔性车间调度算法
  7. idea编译器没有tomcat的选项解决方案
  8. Linux设置bypass网卡,Linux pwn入门教程(7)——PIE与bypass思路
  9. 带您了解虚拟换衣系统
  10. meshlab点云转mesh
  11. 推荐一个好看且实用的火狐浏览器新标签页插件【火狐浏览器新标签页自定义美化】
  12. dejavu歌曲识别介绍
  13. uv转化率多少正常_浏览量(PV)和访客数(UV)和跳出率是什么意思?
  14. Groovy 快速入门
  15. creo中公制单位的设定问题(永久设定)
  16. length属性和length()方法
  17. mysql大写和小写_MySQL大写和小写问题
  18. 一个前端搞淘宝模板那些事
  19. java xtend_Java加上Xtend,满足你对C#语法的所有想象
  20. 域名备案(腾讯云买的域名,在阿里云上进行备案)

热门文章

  1. map组件如何展示marker的callout气泡
  2. fiddler启动后浏览器不能上网问题解决
  3. 【信息系统项目管理师】第三章 立项管理思维导图
  4. 乐有家携手法大大,实现租房签约数字化
  5. 什么是ACL访问控制列表?它们的匹配机制是什么?
  6. 软交换总结之二-七号信令
  7. 关于cocoapods遇到xxxx file not found和No such module 'XXX'的问题
  8. Kubernetes核心组件运行机制
  9. x64dbg安装xAnalyzer插件失败问题解决
  10. 思科-实验10:路由器接口 PPP 协议封装和 PAP、CHAP 验证配置