Skip to content

i582/go-composer.json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages