Documentation
¶
Overview ¶
Package php provides Laravel/PHP development and deployment commands.
Development Commands:
- dev: Start Laravel environment (FrankenPHP, Vite, Horizon, Reverb, Redis)
- logs: Stream unified service logs
- stop: Stop all running services
- status: Show service status
- ssl: Setup SSL certificates with mkcert
Build Commands:
- build: Build Docker or LinuxKit image
- serve: Run production container
- shell: Open shell in running container
Code Quality:
- test: Run PHPUnit/Pest tests
- fmt: Format code with Laravel Pint
- stan: Run PHPStan/Larastan static analysis
- psalm: Run Psalm static analysis
- audit: Security audit for dependencies
- security: Security vulnerability scanning
- qa: Run full QA pipeline
- rector: Automated code refactoring
- infection: Mutation testing for test quality
Package Management:
- packages link/unlink/update/list: Manage local Composer packages
Deployment (Coolify):
- deploy: Deploy to Coolify
- deploy:status: Check deployment status
- deploy:rollback: Rollback deployment
- deploy:list: List recent deployments
Package php provides PHP/Laravel development tools.
Package php provides Laravel/PHP development environment management.
Index ¶
- Constants
- func AddCommands(root *cobra.Command)
- func AddPHPCommands(root *cobra.Command)
- func Analyse(ctx context.Context, opts AnalyseOptions) error
- func BuildDocker(ctx context.Context, opts DockerBuildOptions) error
- func BuildLinuxKit(ctx context.Context, opts LinuxKitBuildOptions) error
- func CertPaths(domain string, opts SSLOptions) (certFile, keyFile string, err error)
- func CertsExist(domain string, opts SSLOptions) bool
- func DetectInfection(dir string) bool
- func DetectPackageManager(dir string) string
- func DetectRector(dir string) bool
- func ExtractDomainFromURL(url string) string
- func Format(ctx context.Context, opts FormatOptions) error
- func GenerateDockerfile(dir string) (string, error)
- func GenerateDockerfileFromConfig(config *DockerfileConfig) string
- func GenerateDockerignore(dir string) string
- func GetLaravelAppName(dir string) string
- func GetLaravelAppURL(dir string) string
- func GetMkcertCARoot() (string, error)
- func GetQAChecks(dir string, stage QAStage) []string
- func GetSSLDir(opts SSLOptions) (string, error)
- func InstallMkcertCA() error
- func IsDeploymentComplete(status string) bool
- func IsDeploymentSuccessful(status string) bool
- func IsFrankenPHPProject(dir string) bool
- func IsLaravelProject(dir string) bool
- func IsMkcertInstalled() bool
- func IsPHPProject(dir string) bool
- func LinkPackages(dir string, packages []string) error
- func RunInfection(ctx context.Context, opts InfectionOptions) error
- func RunParallel(ctx context.Context, opts TestOptions) error
- func RunPsalm(ctx context.Context, opts PsalmOptions) error
- func RunRector(ctx context.Context, opts RectorOptions) error
- func RunTests(ctx context.Context, opts TestOptions) error
- func ServeProduction(ctx context.Context, opts ServeOptions) error
- func SetupSSL(domain string, opts SSLOptions) error
- func SetupSSLIfNeeded(domain string, opts SSLOptions) (certFile, keyFile string, err error)
- func Shell(ctx context.Context, containerID string) error
- func UnlinkPackages(dir string, packages []string) error
- func UpdatePackages(dir string, packages []string) error
- type AnalyseOptions
- type AnalyserType
- type AuditAdvisory
- type AuditOptions
- type AuditResult
- type CICheckResult
- type CIResult
- type CISummary
- type ComposerJSON
- type CoolifyApp
- type CoolifyClient
- func (c *CoolifyClient) GetApp(ctx context.Context, appID string) (*CoolifyApp, error)
- func (c *CoolifyClient) GetDeployment(ctx context.Context, appID, deploymentID string) (*CoolifyDeployment, error)
- func (c *CoolifyClient) ListDeployments(ctx context.Context, appID string, limit int) ([]CoolifyDeployment, error)
- func (c *CoolifyClient) Rollback(ctx context.Context, appID, deploymentID string) (*CoolifyDeployment, error)
- func (c *CoolifyClient) TriggerDeploy(ctx context.Context, appID string, force bool) (*CoolifyDeployment, error)
- type CoolifyConfig
- type CoolifyDeployment
- type DeployOptions
- type DeploymentStatus
- func Deploy(ctx context.Context, opts DeployOptions) (*DeploymentStatus, error)
- func DeployStatus(ctx context.Context, opts StatusOptions) (*DeploymentStatus, error)
- func ListDeployments(ctx context.Context, dir string, env Environment, limit int) ([]DeploymentStatus, error)
- func Rollback(ctx context.Context, opts RollbackOptions) (*DeploymentStatus, error)
- type DetectedService
- type DevServer
- type DockerBuildOptions
- type DockerfileConfig
- type Environment
- type FormatOptions
- type FormatterType
- type FrankenPHPOptions
- type FrankenPHPService
- type HorizonService
- type InfectionOptions
- type LinkedPackage
- type LinuxKitBuildOptions
- type Options
- type PsalmOptions
- type PsalmType
- type QACheckResult
- type QACheckRunResult
- type QAOptions
- type QAResult
- type QARunResult
- type QARunner
- type QAStage
- type RectorOptions
- type RedisOptions
- type RedisService
- type ReverbOptions
- type ReverbService
- type RollbackOptions
- type SSLOptions
- type SecurityCheck
- type SecurityOptions
- type SecurityResult
- type SecuritySummary
- type ServeOptions
- type Service
- type ServiceStatus
- type StatusOptions
- type TestOptions
- type TestRunner
- type ViteOptions
- type ViteService
Constants ¶
const (
// DefaultSSLDir is the default directory for SSL certificates.
DefaultSSLDir = ".core/ssl"
)
Variables ¶
This section is empty.
Functions ¶
func AddCommands ¶
AddCommands registers the 'php' command and all subcommands.
func AddPHPCommands ¶
AddPHPCommands adds PHP/Laravel development commands.
func Analyse ¶
func Analyse(ctx context.Context, opts AnalyseOptions) error
Analyse runs PHPStan or Larastan for static analysis.
func BuildDocker ¶
func BuildDocker(ctx context.Context, opts DockerBuildOptions) error
BuildDocker builds a Docker image for the PHP project.
func BuildLinuxKit ¶
func BuildLinuxKit(ctx context.Context, opts LinuxKitBuildOptions) error
BuildLinuxKit builds a LinuxKit image for the PHP project.
func CertPaths ¶
func CertPaths(domain string, opts SSLOptions) (certFile, keyFile string, err error)
CertPaths returns the paths to the certificate and key files for a domain.
func CertsExist ¶
func CertsExist(domain string, opts SSLOptions) bool
CertsExist checks if SSL certificates exist for the given domain.
func DetectInfection ¶
DetectInfection checks if Infection is available in the project.
func DetectPackageManager ¶
DetectPackageManager detects which package manager is used in the project. Returns "npm", "pnpm", "yarn", or "bun".
func DetectRector ¶
DetectRector checks if Rector is available in the project.
func ExtractDomainFromURL ¶
ExtractDomainFromURL extracts the domain from a URL string.
func Format ¶
func Format(ctx context.Context, opts FormatOptions) error
Format runs Laravel Pint to format PHP code.
func GenerateDockerfile ¶
GenerateDockerfile generates a Dockerfile for a PHP/Laravel project. It auto-detects dependencies from composer.json and project structure.
func GenerateDockerfileFromConfig ¶
func GenerateDockerfileFromConfig(config *DockerfileConfig) string
GenerateDockerfileFromConfig generates a Dockerfile from the given configuration.
func GenerateDockerignore ¶
GenerateDockerignore generates a .dockerignore file content for PHP projects.
func GetLaravelAppName ¶
GetLaravelAppName extracts the application name from Laravel's .env file.
func GetLaravelAppURL ¶
GetLaravelAppURL extracts the application URL from Laravel's .env file.
func GetMkcertCARoot ¶
GetMkcertCARoot returns the path to the mkcert CA root directory.
func GetQAChecks ¶
GetQAChecks returns the checks for a given stage.
func GetSSLDir ¶
func GetSSLDir(opts SSLOptions) (string, error)
GetSSLDir returns the SSL directory, creating it if necessary.
func InstallMkcertCA ¶
func InstallMkcertCA() error
InstallMkcertCA installs the local CA for mkcert.
func IsDeploymentComplete ¶
IsDeploymentComplete returns true if the status indicates completion.
func IsDeploymentSuccessful ¶
IsDeploymentSuccessful returns true if the status indicates success.
func IsFrankenPHPProject ¶
IsFrankenPHPProject checks if the project is configured for FrankenPHP. It looks for laravel/octane with frankenphp driver.
func IsLaravelProject ¶
IsLaravelProject checks if the given directory is a Laravel project. It looks for the presence of artisan file and laravel in composer.json.
func IsMkcertInstalled ¶
func IsMkcertInstalled() bool
IsMkcertInstalled checks if mkcert is available in PATH.
func IsPHPProject ¶
IsPHPProject checks if the given directory is a PHP project.
func LinkPackages ¶
LinkPackages adds path repositories to composer.json for local package development.
func RunInfection ¶
func RunInfection(ctx context.Context, opts InfectionOptions) error
RunInfection runs Infection mutation testing.
func RunParallel ¶
func RunParallel(ctx context.Context, opts TestOptions) error
RunParallel runs tests in parallel using the appropriate runner.
func RunPsalm ¶
func RunPsalm(ctx context.Context, opts PsalmOptions) error
RunPsalm runs Psalm static analysis.
func RunRector ¶
func RunRector(ctx context.Context, opts RectorOptions) error
RunRector runs Rector for automated code refactoring.
func RunTests ¶
func RunTests(ctx context.Context, opts TestOptions) error
RunTests runs PHPUnit or Pest tests.
func ServeProduction ¶
func ServeProduction(ctx context.Context, opts ServeOptions) error
ServeProduction runs a production PHP container.
func SetupSSL ¶
func SetupSSL(domain string, opts SSLOptions) error
SetupSSL creates local SSL certificates using mkcert. It installs the local CA if not already installed and generates certificates for the given domain.
func SetupSSLIfNeeded ¶
func SetupSSLIfNeeded(domain string, opts SSLOptions) (certFile, keyFile string, err error)
SetupSSLIfNeeded checks if certificates exist and creates them if not.
func UnlinkPackages ¶
UnlinkPackages removes path repositories from composer.json.
func UpdatePackages ¶
UpdatePackages runs composer update for specific packages.
Types ¶
type AnalyseOptions ¶
type AnalyseOptions struct {
// Dir is the project directory (defaults to current working directory).
Dir string
// Level is the PHPStan analysis level (0-9).
Level int
// Paths limits analysis to specific paths.
Paths []string
// Memory is the memory limit for analysis (e.g., "2G").
Memory string
// JSON outputs results in JSON format.
JSON bool
// SARIF outputs results in SARIF format for GitHub Security tab.
SARIF bool
// Output is the writer for output (defaults to os.Stdout).
Output io.Writer
}
AnalyseOptions configures PHP static analysis.
type AnalyserType ¶
type AnalyserType string
AnalyserType represents the detected static analyser.
const ( // AnalyserPHPStan indicates standard PHPStan analyser. AnalyserPHPStan AnalyserType = "phpstan" // AnalyserLarastan indicates Laravel-specific Larastan analyser. AnalyserLarastan AnalyserType = "larastan" )
Static analyser type constants.
func DetectAnalyser ¶
func DetectAnalyser(dir string) (AnalyserType, bool)
DetectAnalyser detects which static analyser is available in the project.
type AuditAdvisory ¶
type AuditAdvisory struct {
Package string
Severity string
Title string
URL string
Identifiers []string
}
AuditAdvisory represents a single security advisory.
type AuditOptions ¶
type AuditOptions struct {
Dir string
JSON bool // Output in JSON format
Fix bool // Auto-fix vulnerabilities (npm only)
Output io.Writer
}
AuditOptions configures dependency security auditing.
type AuditResult ¶
type AuditResult struct {
Tool string
Vulnerabilities int
Advisories []AuditAdvisory
Error error
}
AuditResult holds the results of a security audit.
func RunAudit ¶
func RunAudit(ctx context.Context, opts AuditOptions) ([]AuditResult, error)
RunAudit runs security audits on dependencies.
type CICheckResult ¶
type CICheckResult struct {
Name string `json:"name"`
Status string `json:"status"` // passed, failed, warning, skipped
Duration string `json:"duration"`
Details string `json:"details,omitempty"`
Issues int `json:"issues,omitempty"`
Errors int `json:"errors,omitempty"`
Warnings int `json:"warnings,omitempty"`
}
CICheckResult represents an individual check result
type CIResult ¶
type CIResult struct {
Passed bool `json:"passed"`
ExitCode int `json:"exit_code"`
Duration string `json:"duration"`
StartedAt time.Time `json:"started_at"`
Checks []CICheckResult `json:"checks"`
Summary CISummary `json:"summary"`
Artifacts []string `json:"artifacts,omitempty"`
}
CIResult represents the overall CI pipeline result
type CISummary ¶
type CISummary struct {
Total int `json:"total"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Warnings int `json:"warnings"`
Skipped int `json:"skipped"`
}
CISummary contains aggregate statistics
type ComposerJSON ¶
type ComposerJSON struct {
Name string `json:"name"`
Require map[string]string `json:"require"`
RequireDev map[string]string `json:"require-dev"`
}
ComposerJSON represents the structure of composer.json.
type CoolifyApp ¶
type CoolifyApp struct {
ID string `json:"id"`
Name string `json:"name"`
FQDN string `json:"fqdn,omitempty"`
Status string `json:"status,omitempty"`
Repository string `json:"repository,omitempty"`
Branch string `json:"branch,omitempty"`
Environment string `json:"environment,omitempty"`
}
CoolifyApp represents an application from the Coolify API.
type CoolifyClient ¶
CoolifyClient is an HTTP client for the Coolify API.
func NewCoolifyClient ¶
func NewCoolifyClient(baseURL, token string) *CoolifyClient
NewCoolifyClient creates a new Coolify API client.
func (*CoolifyClient) GetApp ¶
func (c *CoolifyClient) GetApp(ctx context.Context, appID string) (*CoolifyApp, error)
GetApp retrieves application details.
func (*CoolifyClient) GetDeployment ¶
func (c *CoolifyClient) GetDeployment(ctx context.Context, appID, deploymentID string) (*CoolifyDeployment, error)
GetDeployment retrieves a specific deployment by ID.
func (*CoolifyClient) ListDeployments ¶
func (c *CoolifyClient) ListDeployments(ctx context.Context, appID string, limit int) ([]CoolifyDeployment, error)
ListDeployments retrieves deployments for an application.
func (*CoolifyClient) Rollback ¶
func (c *CoolifyClient) Rollback(ctx context.Context, appID, deploymentID string) (*CoolifyDeployment, error)
Rollback triggers a rollback to a previous deployment.
func (*CoolifyClient) TriggerDeploy ¶
func (c *CoolifyClient) TriggerDeploy(ctx context.Context, appID string, force bool) (*CoolifyDeployment, error)
TriggerDeploy triggers a deployment for the specified application.
type CoolifyConfig ¶
CoolifyConfig holds configuration loaded from environment.
func LoadCoolifyConfig ¶
func LoadCoolifyConfig(dir string) (*CoolifyConfig, error)
LoadCoolifyConfig loads Coolify configuration from .env file in the given directory.
func LoadCoolifyConfigFromFile ¶
func LoadCoolifyConfigFromFile(path string) (*CoolifyConfig, error)
LoadCoolifyConfigFromFile loads Coolify configuration from a specific .env file.
type CoolifyDeployment ¶
type CoolifyDeployment struct {
ID string `json:"id"`
Status string `json:"status"`
CommitSHA string `json:"commit_sha,omitempty"`
CommitMsg string `json:"commit_message,omitempty"`
Branch string `json:"branch,omitempty"`
CreatedAt time.Time `json:"created_at"`
FinishedAt time.Time `json:"finished_at,omitempty"`
Log string `json:"log,omitempty"`
DeployedURL string `json:"deployed_url,omitempty"`
}
CoolifyDeployment represents a deployment from the Coolify API.
type DeployOptions ¶
type DeployOptions struct {
// Dir is the project directory containing .env config.
Dir string
// Environment is the target environment (production or staging).
Environment Environment
// Force triggers a deployment even if no changes are detected.
Force bool
// Wait blocks until deployment completes.
Wait bool
// WaitTimeout is the maximum time to wait for deployment.
// Defaults to 10 minutes.
WaitTimeout time.Duration
// PollInterval is how often to check deployment status when waiting.
// Defaults to 5 seconds.
PollInterval time.Duration
}
DeployOptions configures a deployment.
type DeploymentStatus ¶
type DeploymentStatus struct {
// ID is the deployment identifier.
ID string
// Status is the current deployment status.
// Values: queued, building, deploying, finished, failed, cancelled
Status string
// URL is the deployed application URL.
URL string
// Commit is the git commit SHA.
Commit string
// CommitMessage is the git commit message.
CommitMessage string
// Branch is the git branch.
Branch string
// StartedAt is when the deployment started.
StartedAt time.Time
// CompletedAt is when the deployment completed.
CompletedAt time.Time
// Log contains deployment logs.
Log string
}
DeploymentStatus represents the status of a deployment.
func Deploy ¶
func Deploy(ctx context.Context, opts DeployOptions) (*DeploymentStatus, error)
Deploy triggers a deployment to Coolify.
func DeployStatus ¶
func DeployStatus(ctx context.Context, opts StatusOptions) (*DeploymentStatus, error)
DeployStatus retrieves the status of a deployment.
func ListDeployments ¶
func ListDeployments(ctx context.Context, dir string, env Environment, limit int) ([]DeploymentStatus, error)
ListDeployments retrieves recent deployments.
func Rollback ¶
func Rollback(ctx context.Context, opts RollbackOptions) (*DeploymentStatus, error)
Rollback triggers a rollback to a previous deployment.
type DetectedService ¶
type DetectedService string
DetectedService represents a service that was detected in a Laravel project.
const ( // ServiceFrankenPHP indicates FrankenPHP server is detected. ServiceFrankenPHP DetectedService = "frankenphp" // ServiceVite indicates Vite frontend bundler is detected. ServiceVite DetectedService = "vite" // ServiceHorizon indicates Laravel Horizon queue dashboard is detected. ServiceHorizon DetectedService = "horizon" // ServiceReverb indicates Laravel Reverb WebSocket server is detected. ServiceReverb DetectedService = "reverb" // ServiceRedis indicates Redis cache/queue backend is detected. ServiceRedis DetectedService = "redis" )
Detected service constants for Laravel projects.
func DetectServices ¶
func DetectServices(dir string) []DetectedService
DetectServices detects which services are needed based on project files.
type DevServer ¶
type DevServer struct {
// contains filtered or unexported fields
}
DevServer manages all development services.
func NewDevServer ¶
NewDevServer creates a new development server manager.
func (*DevServer) Logs ¶
Logs returns a reader for the specified service's logs. If service is empty, returns unified logs from all services.
func (*DevServer) Status ¶
func (d *DevServer) Status() []ServiceStatus
Status returns the status of all services.
type DockerBuildOptions ¶
type DockerBuildOptions struct {
// ProjectDir is the path to the PHP/Laravel project.
ProjectDir string
// ImageName is the name for the Docker image.
ImageName string
// Tag is the image tag (default: "latest").
Tag string
// Platform specifies the target platform (e.g., "linux/amd64", "linux/arm64").
Platform string
// Dockerfile is the path to a custom Dockerfile.
// If empty, one will be auto-generated for FrankenPHP.
Dockerfile string
// NoBuildCache disables Docker build cache.
NoBuildCache bool
// BuildArgs are additional build arguments.
BuildArgs map[string]string
// Output is the writer for build output (default: os.Stdout).
Output io.Writer
}
DockerBuildOptions configures Docker image building for PHP projects.
type DockerfileConfig ¶
type DockerfileConfig struct {
// PHPVersion is the PHP version to use (default: "8.3").
PHPVersion string
// BaseImage is the base Docker image (default: "dunglas/frankenphp").
BaseImage string
// PHPExtensions is the list of PHP extensions to install.
PHPExtensions []string
// HasAssets indicates if the project has frontend assets to build.
HasAssets bool
// PackageManager is the Node.js package manager (npm, pnpm, yarn, bun).
PackageManager string
// IsLaravel indicates if this is a Laravel project.
IsLaravel bool
// HasOctane indicates if Laravel Octane is installed.
HasOctane bool
// UseAlpine uses the Alpine-based image (smaller).
UseAlpine bool
}
DockerfileConfig holds configuration for generating a Dockerfile.
func DetectDockerfileConfig ¶
func DetectDockerfileConfig(dir string) (*DockerfileConfig, error)
DetectDockerfileConfig detects configuration from project files.
type Environment ¶
type Environment string
Environment represents a deployment environment.
const ( // EnvProduction is the production environment. EnvProduction Environment = "production" // EnvStaging is the staging environment. EnvStaging Environment = "staging" )
type FormatOptions ¶
type FormatOptions struct {
// Dir is the project directory (defaults to current working directory).
Dir string
// Fix automatically fixes formatting issues.
Fix bool
// Diff shows a diff of changes instead of modifying files.
Diff bool
// JSON outputs results in JSON format.
JSON bool
// Paths limits formatting to specific paths.
Paths []string
// Output is the writer for output (defaults to os.Stdout).
Output io.Writer
}
FormatOptions configures PHP code formatting.
type FormatterType ¶
type FormatterType string
FormatterType represents the detected formatter.
const ( // FormatterPint indicates Laravel Pint code formatter. FormatterPint FormatterType = "pint" )
Formatter type constants.
func DetectFormatter ¶
func DetectFormatter(dir string) (FormatterType, bool)
DetectFormatter detects which formatter is available in the project.
type FrankenPHPOptions ¶
FrankenPHPOptions configures the FrankenPHP service.
type FrankenPHPService ¶
type FrankenPHPService struct {
// contains filtered or unexported fields
}
FrankenPHPService manages the FrankenPHP/Octane server.
func NewFrankenPHPService ¶
func NewFrankenPHPService(dir string, opts FrankenPHPOptions) *FrankenPHPService
NewFrankenPHPService creates a new FrankenPHP service.
func (*FrankenPHPService) Logs ¶
func (s *FrankenPHPService) Logs(follow bool) (io.ReadCloser, error)
func (*FrankenPHPService) Start ¶
func (s *FrankenPHPService) Start(ctx context.Context) error
Start launches the FrankenPHP Octane server.
func (*FrankenPHPService) Status ¶
func (s *FrankenPHPService) Status() ServiceStatus
func (*FrankenPHPService) Stop ¶
func (s *FrankenPHPService) Stop() error
Stop terminates the FrankenPHP server process.
type HorizonService ¶
type HorizonService struct {
// contains filtered or unexported fields
}
HorizonService manages Laravel Horizon.
func NewHorizonService ¶
func NewHorizonService(dir string) *HorizonService
NewHorizonService creates a new Horizon service.
func (*HorizonService) Start ¶
func (s *HorizonService) Start(ctx context.Context) error
Start launches the Laravel Horizon queue worker.
func (*HorizonService) Status ¶
func (s *HorizonService) Status() ServiceStatus
func (*HorizonService) Stop ¶
func (s *HorizonService) Stop() error
Stop terminates Horizon using its terminate command.
type InfectionOptions ¶
type InfectionOptions struct {
Dir string
MinMSI int // Minimum mutation score indicator (0-100)
MinCoveredMSI int // Minimum covered mutation score (0-100)
Threads int // Number of parallel threads
Filter string // Filter files by pattern
OnlyCovered bool // Only mutate covered code
Output io.Writer
}
InfectionOptions configures Infection mutation testing.
type LinkedPackage ¶
type LinkedPackage struct {
Name string `json:"name"`
Path string `json:"path"`
Version string `json:"version"`
}
LinkedPackage represents a linked local package.
func ListLinkedPackages ¶
func ListLinkedPackages(dir string) ([]LinkedPackage, error)
ListLinkedPackages returns all path repositories from composer.json.
type LinuxKitBuildOptions ¶
type LinuxKitBuildOptions struct {
// ProjectDir is the path to the PHP/Laravel project.
ProjectDir string
// OutputPath is the path for the output image.
OutputPath string
// Format is the output format: "iso", "qcow2", "raw", "vmdk".
Format string
// Template is the LinuxKit template name (default: "server-php").
Template string
// Variables are template variables to apply.
Variables map[string]string
// Output is the writer for build output (default: os.Stdout).
Output io.Writer
}
LinuxKitBuildOptions configures LinuxKit image building for PHP projects.
type Options ¶
type Options struct {
// Dir is the Laravel project directory.
Dir string
// Services specifies which services to start.
// If empty, services are auto-detected.
Services []DetectedService
// NoVite disables the Vite dev server.
NoVite bool
// NoHorizon disables Laravel Horizon.
NoHorizon bool
// NoReverb disables Laravel Reverb.
NoReverb bool
// NoRedis disables the Redis server.
NoRedis bool
// HTTPS enables HTTPS with mkcert certificates.
HTTPS bool
// Domain is the domain for SSL certificates.
// Defaults to APP_URL from .env or "localhost".
Domain string
// Ports for each service
FrankenPHPPort int
HTTPSPort int
VitePort int
ReverbPort int
RedisPort int
}
Options configures the development server.
type PsalmOptions ¶
type PsalmOptions struct {
Dir string
Level int // Error level (1=strictest, 8=most lenient)
Fix bool // Auto-fix issues where possible
Baseline bool // Generate/update baseline file
ShowInfo bool // Show info-level issues
JSON bool // Output in JSON format
SARIF bool // Output in SARIF format for GitHub Security tab
Output io.Writer
}
PsalmOptions configures Psalm static analysis.
type PsalmType ¶
type PsalmType string
PsalmType represents the detected Psalm configuration.
const ( // PsalmStandard indicates standard Psalm configuration. PsalmStandard PsalmType = "psalm" )
Psalm configuration type constants.
func DetectPsalm ¶
DetectPsalm checks if Psalm is available in the project.
type QACheckResult ¶
type QACheckResult struct {
Name string
Stage QAStage
Passed bool
Duration string
Error error
Output string
}
QACheckResult holds the result of a single QA check.
type QACheckRunResult ¶
type QACheckRunResult struct {
Name string `json:"name"`
Passed bool `json:"passed"`
Skipped bool `json:"skipped"`
ExitCode int `json:"exit_code"`
Duration string `json:"duration"`
Output string `json:"output,omitempty"`
}
QACheckRunResult holds the result of a single QA check.
func (QACheckRunResult) GetIssueMessage ¶
func (r QACheckRunResult) GetIssueMessage() string
GetIssueMessage returns an issue message for a check.
type QAOptions ¶
type QAOptions struct {
Dir string
Quick bool // Only run quick checks
Full bool // Run all stages including slow checks
Fix bool // Auto-fix issues where possible
JSON bool // Output results as JSON
}
QAOptions configures the full QA pipeline.
type QAResult ¶
type QAResult struct {
Stages []QAStage
Checks []QACheckResult
Passed bool
Summary string
}
QAResult holds the results of the full QA pipeline.
type QARunResult ¶
type QARunResult struct {
Passed bool `json:"passed"`
Duration string `json:"duration"`
Results []QACheckRunResult `json:"results"`
PassedCount int `json:"passed_count"`
FailedCount int `json:"failed_count"`
SkippedCount int `json:"skipped_count"`
}
QARunResult holds the results of running QA checks.
type QARunner ¶
type QARunner struct {
// contains filtered or unexported fields
}
QARunner orchestrates PHP QA checks using pkg/process.
func NewQARunner ¶
NewQARunner creates a QA runner for the given directory.
func (*QARunner) BuildSpecs ¶
BuildSpecs creates RunSpecs for the given QA checks.
func (*QARunner) GetCheckOutput ¶
GetCheckOutput returns captured output for a check.
type QAStage ¶
type QAStage string
QAStage represents a stage in the QA pipeline.
const ( // QAStageQuick runs fast checks only (audit, fmt, stan). QAStageQuick QAStage = "quick" // QAStageStandard runs standard checks including tests. QAStageStandard QAStage = "standard" // QAStageFull runs all checks including slow security scans. QAStageFull QAStage = "full" )
QA pipeline stage constants.
func GetQAStages ¶
GetQAStages returns the stages to run based on options.
type RectorOptions ¶
type RectorOptions struct {
Dir string
Fix bool // Apply changes (default is dry-run)
Diff bool // Show detailed diff
ClearCache bool // Clear cache before running
Output io.Writer
}
RectorOptions configures Rector code refactoring.
type RedisOptions ¶
RedisOptions configures the Redis service.
type RedisService ¶
type RedisService struct {
// contains filtered or unexported fields
}
RedisService manages a local Redis server.
func NewRedisService ¶
func NewRedisService(dir string, opts RedisOptions) *RedisService
NewRedisService creates a new Redis service.
func (*RedisService) Start ¶
func (s *RedisService) Start(ctx context.Context) error
Start launches the Redis server.
func (*RedisService) Status ¶
func (s *RedisService) Status() ServiceStatus
func (*RedisService) Stop ¶
func (s *RedisService) Stop() error
Stop terminates Redis using the shutdown command.
type ReverbOptions ¶
type ReverbOptions struct {
Port int
}
ReverbOptions configures the Reverb service.
type ReverbService ¶
type ReverbService struct {
// contains filtered or unexported fields
}
ReverbService manages Laravel Reverb WebSocket server.
func NewReverbService ¶
func NewReverbService(dir string, opts ReverbOptions) *ReverbService
NewReverbService creates a new Reverb service.
func (*ReverbService) Start ¶
func (s *ReverbService) Start(ctx context.Context) error
Start launches the Laravel Reverb WebSocket server.
func (*ReverbService) Status ¶
func (s *ReverbService) Status() ServiceStatus
func (*ReverbService) Stop ¶
func (s *ReverbService) Stop() error
Stop terminates the Reverb WebSocket server.
type RollbackOptions ¶
type RollbackOptions struct {
// Dir is the project directory containing .env config.
Dir string
// Environment is the target environment (production or staging).
Environment Environment
// DeploymentID is the deployment to rollback to.
// If empty, rolls back to the previous successful deployment.
DeploymentID string
// Wait blocks until rollback completes.
Wait bool
// WaitTimeout is the maximum time to wait for rollback.
WaitTimeout time.Duration
}
RollbackOptions configures a rollback.
type SSLOptions ¶
type SSLOptions struct {
// Dir is the directory to store certificates.
// Defaults to ~/.core/ssl/
Dir string
}
SSLOptions configures SSL certificate generation.
type SecurityCheck ¶
type SecurityCheck struct {
ID string
Name string
Description string
Severity string
Passed bool
Message string
Fix string
CWE string
}
SecurityCheck represents a single security check result.
type SecurityOptions ¶
type SecurityOptions struct {
Dir string
Severity string // Minimum severity (critical, high, medium, low)
JSON bool // Output in JSON format
SARIF bool // Output in SARIF format
URL string // URL to check HTTP headers (optional)
Output io.Writer
}
SecurityOptions configures security scanning.
type SecurityResult ¶
type SecurityResult struct {
Checks []SecurityCheck
Summary SecuritySummary
}
SecurityResult holds the results of security scanning.
func RunSecurityChecks ¶
func RunSecurityChecks(ctx context.Context, opts SecurityOptions) (*SecurityResult, error)
RunSecurityChecks runs security checks on the project.
type SecuritySummary ¶
SecuritySummary summarizes security check results.
type ServeOptions ¶
type ServeOptions struct {
// ImageName is the Docker image to run.
ImageName string
// Tag is the image tag (default: "latest").
Tag string
// ContainerName is the name for the container.
ContainerName string
// Port is the host port to bind (default: 80).
Port int
// HTTPSPort is the host HTTPS port to bind (default: 443).
HTTPSPort int
// Detach runs the container in detached mode.
Detach bool
// EnvFile is the path to an environment file.
EnvFile string
// Volumes maps host paths to container paths.
Volumes map[string]string
// Output is the writer for output (default: os.Stdout).
Output io.Writer
}
ServeOptions configures running a production PHP container.
type Service ¶
type Service interface {
// Name returns the service name.
Name() string
// Start starts the service.
Start(ctx context.Context) error
// Stop stops the service gracefully.
Stop() error
// Logs returns a reader for the service logs.
Logs(follow bool) (io.ReadCloser, error)
// Status returns the current service status.
Status() ServiceStatus
}
Service represents a managed development service.
type ServiceStatus ¶
ServiceStatus represents the status of a service.
type StatusOptions ¶
type StatusOptions struct {
// Dir is the project directory containing .env config.
Dir string
// Environment is the target environment (production or staging).
Environment Environment
// DeploymentID is a specific deployment to check.
// If empty, returns the latest deployment.
DeploymentID string
}
StatusOptions configures a status check.
type TestOptions ¶
type TestOptions struct {
// Dir is the project directory (defaults to current working directory).
Dir string
// Filter filters tests by name pattern.
Filter string
// Parallel runs tests in parallel.
Parallel bool
// Coverage generates code coverage.
Coverage bool
// CoverageFormat is the coverage output format (text, html, clover).
CoverageFormat string
// Groups runs only tests in the specified groups.
Groups []string
// JUnit outputs results in JUnit XML format via --log-junit.
JUnit bool
// Output is the writer for test output (defaults to os.Stdout).
Output io.Writer
}
TestOptions configures PHP test execution.
type TestRunner ¶
type TestRunner string
TestRunner represents the detected test runner.
const ( // TestRunnerPest indicates Pest testing framework. TestRunnerPest TestRunner = "pest" // TestRunnerPHPUnit indicates PHPUnit testing framework. TestRunnerPHPUnit TestRunner = "phpunit" )
Test runner type constants.
func DetectTestRunner ¶
func DetectTestRunner(dir string) TestRunner
DetectTestRunner detects which test runner is available in the project. Returns Pest if tests/Pest.php exists, otherwise PHPUnit.
type ViteOptions ¶
ViteOptions configures the Vite service.
type ViteService ¶
type ViteService struct {
// contains filtered or unexported fields
}
ViteService manages the Vite development server.
func NewViteService ¶
func NewViteService(dir string, opts ViteOptions) *ViteService
NewViteService creates a new Vite service.
func (*ViteService) Start ¶
func (s *ViteService) Start(ctx context.Context) error
Start launches the Vite development server.
func (*ViteService) Status ¶
func (s *ViteService) Status() ServiceStatus
func (*ViteService) Stop ¶
func (s *ViteService) Stop() error
Stop terminates the Vite development server.