autoloader

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinBasename

func BinBasename(binEntry string) string

BinBasename extracts the filename from a bin entry path.

func BuildIncludePath

func BuildIncludePath(packageName, binEntry string) string

BuildIncludePath returns the PHP include path string for a bin proxy.

func CheckComposerVersion

func CheckComposerVersion(composerPath string) error

CheckComposerVersion verifies Composer >= 2.0.

func FindComposer

func FindComposer(projectDir string) (string, error)

FindComposer locates the composer binary by precedence: 1. ALLEGRO_COMPOSER_PATH env var 2. "composer" in PATH 3. "composer.phar" in projectDir

func GenerateInstalledJSON

func GenerateInstalledJSON(lock *parser.ComposerLock) ([]byte, error)

GenerateInstalledJSON creates installed.json content from composer.lock data.

func GenerateInstalledPHP

func GenerateInstalledPHP(lock *parser.ComposerLock, composerJSON map[string]interface{}) string

GenerateInstalledPHP creates installed.php content.

func GeneratePHPProxyNoShebang

func GeneratePHPProxyNoShebang(packageName, binEntry string) string

GeneratePHPProxyNoShebang generates the proxy for PHP targets without a shebang.

func GeneratePHPProxyWithShebang

func GeneratePHPProxyWithShebang(packageName, binEntry string) string

GeneratePHPProxyWithShebang generates the proxy for PHP targets with a shebang.

func GenerateShellProxy

func GenerateShellProxy(packageName, binEntry string) string

GenerateShellProxy generates the POSIX shell proxy for non-PHP targets.

func RunDumpautoload

func RunDumpautoload(composerPath, projectDir string, verbose, noDev bool) error

RunDumpautoload runs "composer dumpautoload" in the given directory. Does not use --optimize by default, matching Composer's own install behavior. Users who want optimized autoloading can run `composer dumpautoload --optimize` separately.

func WriteInstalledFiles

func WriteInstalledFiles(vendorDir string, lock *parser.ComposerLock, composerJSON map[string]interface{}) error

WriteInstalledFiles writes installed.json and installed.php to vendor/composer/.

Types

type BinTargetType

type BinTargetType int

BinTargetType classifies a bin target file.

const (
	BinPHPNoShebang BinTargetType = iota
	BinPHPWithShebang
	BinNonPHP
)

func DetectBinTarget

func DetectBinTarget(path string) (BinTargetType, error)

DetectBinTarget reads the first 500 bytes and classifies the file.

type InstalledJSON

type InstalledJSON struct {
	Packages        []InstalledPackage `json:"packages"`
	Dev             bool               `json:"dev"`
	DevPackageNames []string           `json:"dev-package-names"`
}

InstalledJSON represents vendor/composer/installed.json.

type InstalledPackage

type InstalledPackage struct {
	Name              string                 `json:"name"`
	Version           string                 `json:"version"`
	VersionNormalized string                 `json:"version_normalized,omitempty"`
	Type              string                 `json:"type"`
	Require           map[string]string      `json:"require,omitempty"`
	Autoload          interface{}            `json:"autoload"`
	InstallPath       string                 `json:"install-path"`
	Extra             map[string]interface{} `json:"extra,omitempty"`
	Description       string                 `json:"description,omitempty"`
	Bin               []string               `json:"bin,omitempty"`
	NotificationURL   string                 `json:"notification-url,omitempty"`
	Replace           map[string]string      `json:"replace,omitempty"`
	Provide           map[string]string      `json:"provide,omitempty"`
	Source            map[string]interface{} `json:"source,omitempty"`
}

InstalledPackage represents a single package in installed.json. InstalledPackage represents a single package in installed.json.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL