i582 / go-composer.json

Small library for manipulating the composer.json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

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

About

Small library for manipulating the composer.json

License:MIT License


Languages

Language:Go 100.0%