franzl/studio
Composer 安装命令:
composer require franzl/studio
包简介
Develop your Composer libraries with style
README 文档
README
Develop your Composer libraries with style.
This package makes it easy to develop Composer packages while using them.
Instead of installing the packages you're working on from the Packagist repository, use Studio to symlink them from the filesystem instead.
Under the hood, it uses Composer's path repositories to do so.
As a result, you won't have to develop in the vendor directory.
Studio also knows how to configure development tools that might be part of your workflow. This includes the following:
- Autoloading (
srcandtests) - PhpUnit
- PhpSpec
- TravisCI
This list will only get longer in the future.
Installation
Studio can be installed globally or per project, with Composer:
Globally (recommended): composer global require franzl/studio
(use as studio)
Make sure that the ~/.composer/vendor/bin directory is added to your PATH, so that the
studioexecutable can be located by your system.
Per project: composer require --dev franzl/studio
(use as vendor/bin/studio)
Usage
All commands should be run from the root of your project, where the composer.json file is located.
Workflow
Typically, you will want to require one of your own Composer packages in an application. With Studio, you can pull in your local copy of the package instead of the version hosted on Packagist. The kicker: You can keep developing your library while you dogfood it, but you won't need to change your composer.json file.
Loading local packages
To use one of your own libraries within your application, you need to tell Studio where it can locate the library.
You can do so with the load command.
When Composer resolves its dependencies, Studio will then pitch in and symlink your local directory to Composer's vendor directory.
So, to have Studio manage your awesome world domination library, all you have to do is run the following command:
$ studio load path/to/world-domination
This command should create a studio.json file in the current working directory.
It contains a list of directories for Studio to load.
Next, if you haven't already done so, make sure you actually require the package in your composer.json:
"require": {
"my/world-domination": "dev-master"
}
And finally, tell Studio to set up the symlinks:
$ composer update my/world-domination
If all goes well, you should now see a brief message along the following as part of Composer's output:
[Studio] Loading path installer
This is what will happen under the hood:
- Composer begins checking dependencies for updates.
- Studio jumps in and informs Composer to prefer packages from the directories listed in the
studio.jsonfile over downloading them from Packagist. - Composer symlinks these packages into the
vendordirectory or any other appropriate place (e.g. for custom installers). Thus, to your application, these packages will behave just like "normal" Composer packages. - Composer generates proper autoloading rules for the Studio packages.
- For non-Studio packages, Composer works as always.
Pro tip: If you keep all your libraries in one directory, you can let Studio find all of them by using a wildcard:
$ studio load 'path/to/my/libraries/*'
Kickstarting package development
If you haven't started world domination yet, Studio also includes a handy generator for new Composer packages. Besides the usual ceremony, it contains several optional components, such as configuration for unit tests, continuous integration on Travis-CI and others.
First, we need to create the local directory for the development package:
$ studio create domination
# or if you want to clone a git repo
$ studio create domination --git git@github.com:vendor/domination.git
After asking you a series of questions, this will create (or download) a package in the domination subdirectory inside the current working directory.
There is a good chance that you need a little time to develop this package before publishing it on Packagist.
Therefore, if you ran this command in a Composer application, Studio will offer you to load your new package immediately.
This essentially comes down to running studio load domination.
Finally, don't forget to use composer require to actually add your package as a dependency.
Command Reference
create: Create a new package skeleton
$ studio create foo/bar
This command creates a skeleton for a new Composer package, already filled with some helpful files to get you started.
In the above example, we're creating a new package in the folder foo/bar in your project root.
All its dependencies will be available when using Composer.
During creation, you will be asked a series of questions to configure your skeleton. This will include things like configuration for testing tools, Travis CI, and autoloading.
create --git: Manage existing packages by cloning a Git repository
$ studio create bar --git git@github.com:me/myrepo.git
This will clone the given Git repository to the bar directory and install its dependencies.
create --submodule: Manage existing packages by loading a Git repository as submodule
$ studio create bar --submodule git@github.com:me/myrepo.git
This will load the given Git repository to the bar directory as a submodule and install its dependencies.
create --options: Provide specific options to Git when loading the repository
$ studio create bar --git git@github.com:me/myrepo.git --options="--single-branch --branch=mybranch"
$ studio create bar --submodule git@github.com:me/myrepo.git --options="-b mybranch"
This will load the given Git repository and checkout a specific branch.
To have an overview of all the options available to you, check git clone --help and git submodule add --help.
load: Make all packages from the given local path available to Composer
$ studio load baz
This will make sure all packages in the baz directory (paths with wildcards are supported, too) will be autoloadable using Composer.
unload: Stop managing a local path
$ studio unload foo
This will remove the path foo from the studio.json configuration file.
This means any packages in that path will not be available to Composer anymore (unless they are still hosted on Packagist).
This does not remove the package contents from the file system.
See scrap for completely removing a package.
You can reload the path using the load command.
scrap: Remove a package
Sometimes you want to throw away a package.
You can do so with the scrap command, passing a path for a Studio-managed package:
$ studio scrap foo
Don't worry - you'll be asked for confirmation first.
License
This code is published under the MIT License. This means you can do almost anything with it, as long as the copyright notice and the accompanying license file is left intact.
Contributing
Feel free to send pull requests or create issues if you come across problems or have great ideas. Any input is appreciated!
franzl/studio for enterprise
Available as part of the Tidelift Subscription
The maintainers of franzl/studio and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
franzl/studio 适用场景与选型建议
franzl/studio 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 639.19k 次下载、GitHub Stars 达 1.14k, 最近一次更新时间为 2015 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「composer」 「workflow」 「development」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 franzl/studio 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 franzl/studio 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 franzl/studio 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Workflow logger
Library with classes to help you do batch.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
GHT D-Tools Bundle
统计信息
- 总下载量: 639.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1143
- 点击次数: 30
- 依赖项目数: 15
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-01