diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 35c78f4..61abefa 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,29 +1,43 @@
name: Release
-on: push
+on:
+ push:
+ branches:
+ - main
jobs:
- build:
- runs-on: macos-latest
+ publish-build:
+ runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
with:
- php-version: 8.3
- tools: composer:v2, box
-
- - name: Install PHP deps
- uses: ramsey/composer-install@v3
-
- - name: Build
- run: make build
-
- - name: Release
- uses: softprops/action-gh-release@v2
- if: startsWith(github.ref, 'refs/tags/')
+ go-version: "1.23"
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
with:
- files: |
- build/phpup
+ node-version: "20"
+
+ - name: Install dependencies
+ run: go mod download
+
+ - name: Build for multiple platforms
+ run: |
+ GOOS=linux GOARCH=amd64 go build -o build/phpup-linux-amd64
+ GOOS=linux GOARCH=arm64 go build -o build/phpup-linux-arm64
+ GOOS=darwin GOARCH=amd64 go build -o build/phpup-darwin-amd64
+ GOOS=darwin GOARCH=arm64 go build -o build/phpup-darwin-arm64
+ GOOS=windows GOARCH=amd64 go build -o build/phpup-windows-amd64.exe
+
+ - name: Install semantic-release
+ run: |
+ npm install -g semantic-release @semantic-release/github @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/release-notes-generator
+
+ - name: Semantic Release
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: npx semantic-release
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
new file mode 100644
index 0000000..a2685ba
--- /dev/null
+++ b/.github/workflows/run-tests.yml
@@ -0,0 +1,24 @@
+name: Release
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ run-tests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: "1.23"
+
+ - name: Install dependencies
+ run: go mod download
+
+ - name: Run tests
+ run: go test ./...
diff --git a/.gitignore b/.gitignore
index 88703d4..0424281 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,25 @@
-/vendor/
-/build/
-/.box_dump/
-/tmp/
-/composer.lock
-/patches.lock.json
.DS_Store
+
+# Binaries for programs and plugins
+phpup
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+# Go workspace file
+go.work
+
+# Build artifacts
+build/
+phpup-*
diff --git a/.releaserc.json b/.releaserc.json
new file mode 100644
index 0000000..ae850b7
--- /dev/null
+++ b/.releaserc.json
@@ -0,0 +1,35 @@
+{
+ "plugins": [
+ "@semantic-release/commit-analyzer",
+ "@semantic-release/release-notes-generator",
+ "@semantic-release/changelog",
+ [
+ "@semantic-release/github",
+ {
+ "assets": [
+ {
+ "path": "build/phpup-linux-amd64",
+ "label": "Linux AMD64"
+ },
+ {
+ "path": "build/phpup-linux-arm64",
+ "label": "Linux ARM64"
+ },
+ {
+ "path": "build/phpup-darwin-amd64",
+ "label": "macOS AMD64"
+ },
+ {
+ "path": "build/phpup-darwin-arm64",
+ "label": "macOS ARM64"
+ },
+ {
+ "path": "build/phpup-windows-amd64.exe",
+ "label": "Windows AMD64"
+ }
+ ]
+ }
+ ],
+ "@semantic-release/git"
+ ]
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..53686e1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,44 @@
+# [0.3.0](https://github.com/priyashpatil/phpup/compare/v0.2.0...v0.3.0) (2024-10-17)
+
+
+### Features
+
+* add windows install script ([d7f2669](https://github.com/priyashpatil/phpup/commit/d7f2669b82bee9bf0dab4656fdd58371386eeba2))
+
+# [0.2.0](https://github.com/priyashpatil/phpup/compare/v0.1.3...v0.2.0) (2024-10-17)
+
+
+### Features
+
+* add linux install ([8dcde9c](https://github.com/priyashpatil/phpup/commit/8dcde9c65bdea87da6c6c97c50da124b326ca77c))
+
+## [0.1.3](https://github.com/priyashpatil/phpup/compare/v0.1.2...v0.1.3) (2024-10-17)
+
+
+### Bug Fixes
+
+* mac install script ([70a44ec](https://github.com/priyashpatil/phpup/commit/70a44ec72d016fd08e52bb3f40495b4fe1baa1cf))
+
+## [0.1.2](https://github.com/priyashpatil/phpup/compare/v0.1.1...v0.1.2) (2024-10-17)
+
+
+### Bug Fixes
+
+* build artifact ([00dc40a](https://github.com/priyashpatil/phpup/commit/00dc40aff0421d4861c10f55b07e6864d191b4a5))
+* **ci:** build ([e2d9bd4](https://github.com/priyashpatil/phpup/commit/e2d9bd45310fdf4bae7a64560a64177e0869b23f))
+
+## [0.1.1](https://github.com/priyashpatil/phpup/compare/v0.1.0...v0.1.1) (2024-10-17)
+
+
+### Bug Fixes
+
+* ci build id reference ([9701fb0](https://github.com/priyashpatil/phpup/commit/9701fb0fa6f6d063f5660cd2bb241bb64005106b))
+
+# [0.1.0](https://github.com/priyashpatil/phpup/compare/v0.0.1...v0.1.0) (2024-10-17)
+
+
+### Features
+
+* add mac install script ([1583d95](https://github.com/priyashpatil/phpup/commit/1583d9526185d7deeca5481e8b56a309b156e75a))
+
+# 0.0.1 (2024-10-17)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7521dd0..0000000
--- a/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-.PHONY: all build clean
-
-build:
- ./build.sh
diff --git a/README.md b/README.md
index 3029c61..ff3cc55 100644
--- a/README.md
+++ b/README.md
@@ -1,84 +1,63 @@
-
- phpup
The PHP Toolchain
-
+# phpup
-_Phpup_ is a single-file binary with _**zero dependencies**_ that includes Composer and other PHP tools. It also allows installing a per-project PHP based on your `composer.json`.
-
-You don't need to have PHP or anything at all on your system to run it.
-
-> [!WARNING]
-> **Under heavy development**
-> Currently, this is an MVP, and only macOS aarch64 is supported.
+phpup - CLI tool for managing PHP environments.
## Installation
-Download `phpup` binary from the release page and put it into a directory on your PATH, so you can simply call `phpup` from any directory.
+### macOS and Linux
-```bash
-curl -OL https://github.com/pronskiy/phpup/releases/latest/download/phpup
-chmod +x phpup
-sudo mv phpup /usr/local/bin/phpup
+To install on macOS or Linux, run the following command in your terminal:
+
+```sh
+curl -fsSL https://raw.githubusercontent.com/priyashpatil/phpup/main/install/unix.sh | bash
```
-## Usage
+### Windows
-- `phpup list` – See the list of available commands.
-- `phpup ` – Run any php file. 🚧
-- `phpup composer` – Composer that does not require PHP to be installed.
-- `phpup conductor ` – Like npx but for PHP. 🚧
-- `phpup locus` – Installs PHP binary under your project's `vendor/bin/php` based on the requirements in _composer.json_.
+For Windows 64-bit, follow these steps:
-- ~~`phpup phpstan` – PHPStan that does not require PHP. 🚧~~
-- ~~`phpup rector` – Rector that does not require PHP. 🚧~~
+1. Open PowerShell as Administrator
+2. Run the following command:
-## Contributing
+```powershell
+iwr -useb https://raw.githubusercontent.com/priyashpatil/phpup/main/install/windows.ps1 | iex
+```
-Contributions are very welcome! However, it's recommended to first create an issue describing the idea — let's find the best approach together.
+## Roadmap
-See some ideas in the todo list below.
+- [x] Simple cross platform automated build
+- [x] Easy to install cross platform script
+- [ ] Base php install
+- [ ] Built in Composer
+- [ ] Multiple PHP installs
+- [ ] Switching PHP versions
+- [ ] Opt in Xdebug install
+- [ ] Per project PHP installation
+- [ ] Doctor
+- [ ] Extensions
+- [ ] Docker Images
-### Build Requirements
+## Contributing
-Before you begin, ensure you have met the following requirements:
+Pull requests are welcome. For major changes, please open an issue first
+to discuss what you would like to change.
-- [Make](https://www.gnu.org/software/make/) (version 3.0 or later)
-- [Box](https://github.com/box-project/box) (version 4.x)
+Commit message standards are based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
-Building Binary
+### Build
-```shell
-make build
+```sh
+go build
```
-### TODO
-
-- [x] Run php script [https://github.com/pronskiy/phpup/issues/1](https://github.com/pronskiy/phpup/issues/1)
+### Testing
-- [ ] Accept a reference to a packagist/gh repo, to be able to run its scripts/bin/
- - [https://twitter.com/AdrienBrault/status/1782476060426179049](https://twitter.com/AdrienBrault/status/1782476060426179049)
- - [https://twitter.com/pronskiy/status/1768219585151402251](https://twitter.com/pronskiy/status/1768219585151402251)
- - [https://github.com/artisan-build/conductor](https://github.com/artisan-build/conductor)
- - [https://github.com/pronskiy/conductor](https://github.com/pronskiy/conductor)
- - [https://github.com/artisan-build/conductor/issues/8](https://github.com/artisan-build/conductor/issues/8)
-
-- [ ] Support Windows
-- [ ] Support Linux
-
-- [ ] Make symfony/console app
-- [ ] Add help command
-
-- [ ] Extract packing with box and micro php to a stand-alone GitHub action
-- [ ] Reduce size of the resulting binary
-- [ ] Check microphp's [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md):
- - [ ] Bypass cli SAPI name checks
- - [ ] static_opcache
-
-- ~~[ ] Add more tools~~
- - ~~[ ] PHP-CS-Fixer~~
- - ~~[ ] PHPUnit~~
-- ~~[ ] Support Rector 🚧~~
-- ~~[ ] Support PHPStan 🚧~~
+```sh
+go test ./tests
+```
-## Credits
+Step Debugging with VSCode:
-This package entirely relies on [https://github.com/static-php](https://github.com/static-php) and [https://github.com/easysoft/phpmicro](https://github.com/easysoft/phpmicro).
+```sh
+go install github.com/go-delve/delve/cmd/dlv@latest
+```
diff --git a/box.json b/box.json
deleted file mode 100644
index b635dc9..0000000
--- a/box.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "files": [
-
- ],
- "files-bin": [
- "vendor/bin/var-dump-server"
- ],
- "directories": [
- "vendor"
- ]
-}
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 5db916c..0000000
--- a/build.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-set -e
-
-rm -rf ./build/phpup
-rm -rf ./build/index.*
-
-box compile
-mkdir -p ./build
-mv index.phar ./build/
-
-# Detect OS and architecture
-if [[ "$OSTYPE" == "darwin"* ]]; then
- OS="macos"
- if [[ $(uname -m) == "arm64" ]]; then
- ARCH="aarch64"
- else
- ARCH="x86_64"
- fi
-elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
- OS="linux"
- if [[ $(uname -m) == "aarch64" ]]; then
- ARCH="aarch64"
- else
- ARCH="x86_64"
- fi
-else
- echo "Unsupported operating system"
- exit 1
-fi
-
-# Construct the download URL
-PHP_VERSION="8.3.6"
-DOWNLOAD_URL="https://dl.static-php.dev/static-php-cli/common/php-${PHP_VERSION}-micro-${OS}-${ARCH}.tar.gz"
-
-# Download and extract
-cd build || exit
-echo "Downloading from: $DOWNLOAD_URL"
-curl -L -O "$DOWNLOAD_URL"
-tar -xvf "php-${PHP_VERSION}-micro-${OS}-${ARCH}.tar.gz"
-cat ./micro.sfx ./index.phar >./phpup && chmod 0755 ./phpup
diff --git a/cmd/root.go b/cmd/root.go
new file mode 100644
index 0000000..c36d0ca
--- /dev/null
+++ b/cmd/root.go
@@ -0,0 +1,94 @@
+/*
+Copyright © 2024 Priyash Patil
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package cmd
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/spf13/cobra"
+ "github.com/spf13/viper"
+)
+
+var cfgFile string
+
+// rootCmd represents the base command when called without any subcommands
+var rootCmd = &cobra.Command{
+ Use: "phpup",
+ Short: "Manage PHP environments 🐘",
+ Long: `phpup - CLI tool to manage PHP environments 🚀
+
+phpup 0.0.1 (build: dev)
+Composer version unknown
+PHP version unknown
+`,
+ // Uncomment the following line if your bare application
+ // has an action associated with it:
+ // Run: func(cmd *cobra.Command, args []string) { },
+}
+
+// Execute adds all child commands to the root command and sets flags appropriately.
+// This is called by main.main(). It only needs to happen once to the rootCmd.
+func Execute() {
+ err := rootCmd.Execute()
+ if err != nil {
+ os.Exit(1)
+ }
+}
+
+func init() {
+ cobra.OnInitialize(initConfig)
+
+ // Here you will define your flags and configuration settings.
+ // Cobra supports persistent flags, which, if defined here,
+ // will be global for your application.
+
+ rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.phpup.yaml)")
+
+ // Cobra also supports local flags, which will only run
+ // when this action is called directly.
+ rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
+}
+
+// initConfig reads in config file and ENV variables if set.
+func initConfig() {
+ if cfgFile != "" {
+ // Use config file from the flag.
+ viper.SetConfigFile(cfgFile)
+ } else {
+ // Find home directory.
+ home, err := os.UserHomeDir()
+ cobra.CheckErr(err)
+
+ // Search config in home directory with name ".phpup" (without extension).
+ viper.AddConfigPath(home)
+ viper.SetConfigType("yaml")
+ viper.SetConfigName(".phpup")
+ }
+
+ viper.AutomaticEnv() // read in environment variables that match
+
+ // If a config file is found, read it in.
+ if err := viper.ReadInConfig(); err == nil {
+ fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
+ }
+}
+
+// GetRootCmd returns the root command for the application.
+// This allows external packages to access the root command for testing.
+func GetRootCmd() *cobra.Command {
+ return rootCmd
+}
diff --git a/composer.json b/composer.json
deleted file mode 100644
index 881c9ef..0000000
--- a/composer.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "pronskiy/phpup",
- "description": "The PHP toolchain installer",
- "keywords": [
- "php",
- "toolchain",
- "composer"
- ],
- "license": "MIT",
- "minimum-stability": "dev",
-
- "repositories": [
- {
- "type": "git",
- "url": "https://github.com/pronskiy/conductor.git"
- }
- ],
-
- "require": {
- "php": "^8.3",
- "composer/composer": "^2.7.3",
- "symfony/var-dumper": "^v7.0.6",
- "cweagans/composer-patches": "^2.0.0-beta2",
- "pronskiy/locus": "^0.2",
- "artisan-build/conductor": "@dev"
- },
- "extra": {
- "patches": {
- "symfony/var-dumper": {
- "Fix SAPI": "patches/symfony/var-dumper.patch"
- },
- "composer/composer": {
- "Fix SAPI": "patches/composer/composer.patch"
- }
- }
- },
- "config": {
- "allow-plugins": {
- "cweagans/composer-patches": true,
- "pronskiy/locus": false
- }
- }
-}
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..a086a05
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,31 @@
+module github.com/priyashpatil/phpup
+
+go 1.23.2
+
+require (
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
+ github.com/fsnotify/fsnotify v1.7.0 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/magiconair/properties v1.8.7 // indirect
+ github.com/mitchellh/mapstructure v1.5.0 // indirect
+ github.com/pelletier/go-toml/v2 v2.2.2 // indirect
+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
+ github.com/sagikazarmark/locafero v0.4.0 // indirect
+ github.com/sagikazarmark/slog-shim v0.1.0 // indirect
+ github.com/sourcegraph/conc v0.3.0 // indirect
+ github.com/spf13/afero v1.11.0 // indirect
+ github.com/spf13/cast v1.6.0 // indirect
+ github.com/spf13/cobra v1.8.1 // indirect
+ github.com/spf13/pflag v1.0.5 // indirect
+ github.com/spf13/viper v1.19.0 // indirect
+ github.com/stretchr/testify v1.9.0 // indirect
+ github.com/subosito/gotenv v1.6.0 // indirect
+ go.uber.org/atomic v1.9.0 // indirect
+ go.uber.org/multierr v1.9.0 // indirect
+ golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
+ golang.org/x/sys v0.18.0 // indirect
+ golang.org/x/text v0.14.0 // indirect
+ gopkg.in/ini.v1 v1.67.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..774177b
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,65 @@
+github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
+github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
+github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
+github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
+github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
+github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
+github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
+github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
+github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
+github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
+github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
+github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
+github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
+github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
+github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
+github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
+github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
+github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
+github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
+go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
+go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
+go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
+go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
+golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
+golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
+gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/index.php b/index.php
deleted file mode 100644
index 814041f..0000000
--- a/index.php
+++ /dev/null
@@ -1,42 +0,0 @@
-
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package main
+
+import "github.com/priyashpatil/phpup/cmd"
+
+func main() {
+ cmd.Execute()
+}
diff --git a/patches/composer/composer.patch b/patches/composer/composer.patch
deleted file mode 100644
index b753202..0000000
--- a/patches/composer/composer.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/bin/composer b/bin/composer
-index 8bc77e660..4ef74c28d 100755
---- a/bin/composer
-+++ b/bin/composer
-@@ -3,11 +3,11 @@
-
- if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
- if (0 === strpos(__FILE__, 'phar:') && ini_get('register_argc_argv')) {
-- echo 'Composer cannot be run safely on non-CLI SAPIs with register_argc_argv=On. Aborting.'.PHP_EOL;
-- exit(1);
-+// echo 'Composer cannot be run safely on non-CLI SAPIs with register_argc_argv=On. Aborting.'.PHP_EOL;
-+// exit(1);
- }
-
-- echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
-+// echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
- }
-
- if (PHP_VERSION_ID < 70205) {
diff --git a/patches/symfony/var-dumper.patch b/patches/symfony/var-dumper.patch
deleted file mode 100644
index a579cad..0000000
--- a/patches/symfony/var-dumper.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/Resources/bin/var-dump-server b/Resources/bin/var-dump-server
-index f398fce..e69d32e 100755
---- a/Resources/bin/var-dump-server
-+++ b/Resources/bin/var-dump-server
-@@ -11,7 +11,7 @@
- */
-
- if ('cli' !== PHP_SAPI) {
-- throw new Exception('This script must be run from the command line.');
-+// throw new Exception('This script must be run from the command line.');
- }
-
- /**
diff --git a/tests/root_test.go b/tests/root_test.go
new file mode 100644
index 0000000..5426802
--- /dev/null
+++ b/tests/root_test.go
@@ -0,0 +1,54 @@
+package cmd
+
+import (
+ "bytes"
+ "io"
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+
+ "github.com/priyashpatil/phpup/cmd"
+)
+
+func TestExecute(t *testing.T) {
+ t.Run("Execute runs without error", func(t *testing.T) {
+ // Redirect stdout to capture output
+ old := os.Stdout
+ r, w, _ := os.Pipe()
+ os.Stdout = w
+
+ cmd.Execute()
+
+ // Restore stdout
+ w.Close()
+ os.Stdout = old
+
+ var buf bytes.Buffer
+ io.Copy(&buf, r)
+ output := buf.String()
+
+ // Change this assertion to check for the absence of error messages
+ assert.NotContains(t, output, "Error:")
+ })
+}
+
+func TestRootCmdOutput(t *testing.T) {
+ // Create a new command for testing to avoid side effects
+ rootCmd := cmd.GetRootCmd() // Use a function to get the root command
+ buf := new(bytes.Buffer)
+ rootCmd.SetOut(buf)
+ rootCmd.SetErr(buf)
+
+ // Execute the command with the --help flag
+ rootCmd.SetArgs([]string{"--help"})
+ err := rootCmd.Execute()
+
+ assert.NoError(t, err)
+ output := buf.String()
+
+ assert.Contains(t, output, "phpup - CLI tool to manage PHP environments 🚀")
+ assert.Contains(t, output, "phpup 0.0.1 (build: dev)")
+ assert.Contains(t, output, "Composer version unknown")
+ assert.Contains(t, output, "PHP version unknown")
+}