-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend default source path to current directory
- Loading branch information
1 parent
23852d5
commit 2a1f35e
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,65 @@ | ||
# carbon-cli | ||
|
||
CLI tool for Carbon | ||
|
||
## Install | ||
|
||
```shell | ||
composer require carbon-cli/carbon-cli | ||
``` | ||
|
||
Note that if you have `nesbot/carbon` installed yet and try to run a command, Carbon will automatically try to | ||
install the CLI using global composer command. | ||
|
||
## Usage | ||
|
||
### macro | ||
|
||
Generate macro helpers files for your IDE. | ||
|
||
```shell | ||
./vendor/bin/carbon macro NameSpace1\\Class1 NameSpace2\\Class2 src/macro-file.php | ||
``` | ||
|
||
You can pass classes and files to the `macro` commands, classes will be loaded into Carbon as mixin, files will be | ||
loaded via `include` so you can run `Carbon::macro()` inside. | ||
|
||
It will create **_ide_carbon_mixin_instantiated.php** and **_ide_carbon_mixin_macro.php** with all mixin/macro | ||
methods signatures, so your IDE will be able to auto-complete them on Carbon facade and instances. | ||
|
||
You can commit those files into your project. And you should re-run the command when adding a new mixin/macro. | ||
|
||
You also can store the list in your **composer.json**: | ||
|
||
```json | ||
{ | ||
"extra": { | ||
"carbon": { | ||
"macros": [ | ||
"NameSpace1\\Class1", | ||
"NameSpace2\\Class2", | ||
"src/macro-file.php" | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Then run: | ||
|
||
```shell | ||
./vendor/bin/carbon macro --composer | ||
``` | ||
|
||
By default, the command will only consider the current directory (app, sources, tests, vendor, etc.) and so will | ||
also include the composer settings of your installed vendor packages. | ||
|
||
To restrict to a given directory, use: | ||
|
||
```shell | ||
./vendor/bin/carbon macro --source-path app/Carbon | ||
``` | ||
|
||
This will consider only mixin/macro declared inside **app/Carbon** directory. | ||
|
||
This option can be used either with `--composer` option, with arguments list or both. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters