go-composer.json is a small library for manipulating the composer.json
configuration file.
go get github.com/i582/go-composer.json
- Resolving of namespaces for PSR-4 autoload.
- Working with local dependencies, resolving paths to them.
- Custom checks for config.
To resolve the path to the namespace, use the Psr4PathForNamespace
method.
To add a custom check, use the AddCheck
method.
Example:
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
})
MIT