https://github.com/i582/go-composer.json
Small library for manipulating the composer.json
https://github.com/i582/go-composer.json
composer composer-go
Last synced: 21 days ago
JSON representation
Small library for manipulating the composer.json
- Host: GitHub
- URL: https://github.com/i582/go-composer.json
- Owner: i582
- License: mit
- Created: 2020-10-17T18:32:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-23T21:26:04.000Z (over 4 years ago)
- Last Synced: 2024-06-20T14:26:59.158Z (12 months ago)
- Topics: composer, composer-go
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-composer.json
go-composer.json is a small library for manipulating the `composer.json` configuration file.
### Install
```
go get github.com/i582/go-composer.json
```### Supported
1. Resolving of namespaces for PSR-4 autoload.
2. Working with local dependencies, resolving paths to them.
3. Custom checks for config.#### PSR-4
To resolve the path to the namespace, use the `Psr4PathForNamespace` method.
#### Custom checks
To add a custom check, use the `AddCheck` method.
Example:
```go
cfg.AddCheck(func(config *composer.Config) *composer.ConfigError {
if !strings.HasPrefix(config.Name, "my/") {
return &composer.ConfigError{
Msg: "name must starts with prefix my/",
Critical: true,
}
}
return nil
})
```### License
MIT