PHPackages                             mojo/cli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. mojo/cli

ActiveLibrary[CLI &amp; Console](/categories/cli)

mojo/cli
========

Cross-platform PHP CLI for Mojo secrets management with bash automation compatibility

1.3(7mo ago)08MITPHPPHP &gt;=8.0

Since Oct 6Pushed 7mo agoCompare

[ Source](https://github.com/mzainzulifqar/mojo-secret)[ Packagist](https://packagist.org/packages/mojo/cli)[ RSS](/packages/mojo-cli/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Mojo CLI Tool
=============

[](#mojo-cli-tool)

Cross-platform PHP CLI for Mojo's Infisical secrets management.

🚀 Installation
--------------

[](#-installation)

### Global Installation (Recommended)

[](#global-installation-recommended)

```
composer global require mojo/cli
export PATH="$PATH:$HOME/.composer/vendor/bin"
```

### Update Package

[](#update-package)

```
# Update to latest version
composer global update mojo/cli

# Check current version
composer global show mojo/cli

# Force reinstall if needed
composer global remove mojo/cli
composer global require mojo/cli
```

### Local Installation

[](#local-installation)

```
git clone this-repo
cd mojo-cli
composer install
```

🔧 One-Time Setup (Permanent)
----------------------------

[](#-one-time-setup-permanent)

### Set Environment Variables

[](#set-environment-variables)

**Bash users:**

```
# Add to .bashrc permanently
echo 'export INFISICAL_CLIENT_ID="your-client-id"' >> ~/.bashrc
echo 'export INFISICAL_CLIENT_SECRET="your-client-secret"' >> ~/.bashrc

# Reload .bashrc in current session
source ~/.bashrc

# Verify variables are saved in .bashrc
grep "INFISICAL" ~/.bashrc
```

**Zsh users:**

```
# Add to .zshrc permanently
echo 'export INFISICAL_CLIENT_ID="your-client-id"' >> ~/.zshrc
echo 'export INFISICAL_CLIENT_SECRET="your-client-secret"' >> ~/.zshrc

# Reload .zshrc in current session
source ~/.zshrc

# Verify variables are saved in .zshrc
grep "INFISICAL" ~/.zshrc
```

**Manual setup:**

```
# Edit your shell profile
vim ~/.bashrc  # or ~/.zshrc

# Add these lines:
export INFISICAL_CLIENT_ID="your-client-id"
export INFISICAL_CLIENT_SECRET="your-client-secret"

# Save and reload
source ~/.bashrc
```

### Verify Setup

[](#verify-setup)

```
# Check variables are loaded in current session
echo $INFISICAL_CLIENT_ID
echo $INFISICAL_CLIENT_SECRET

# Check variables are saved in shell profile
grep "INFISICAL" ~/.zshrc     # For Zsh users
grep "INFISICAL" ~/.bashrc    # For Bash users

# Verify variables persist in new terminal
# (Open a new terminal and run):
echo "Client ID: $INFISICAL_CLIENT_ID"
```

📋 Commands
----------

[](#-commands)

### Initialize Project

[](#initialize-project)

```
# Interactive environment selection
mojocli init --name="Project Name"

# Specify environment directly
mojocli init --name="Project Name" --env="dev"
mojocli init --name="Project Name" --env="staging"
mojocli init --name="Project Name" --env="prod"
```

Creates `infisical.json` in current directory.

### Fetch Secrets (Pull)

[](#fetch-secrets-pull)

```
# Interactive environment selection with custom output
mojocli pull --output=.env.local

# Specify environment and output file
mojocli pull --env=dev --output=.env.local
mojocli pull --env=staging --output=.env.staging
mojocli pull --env=prod --output=.env.prod

# Export to shell
export $(cat .env.local | xargs)

# Pull directly to .env file
mojocli pull --env=dev --output=.env
```

### Push Secrets

[](#push-secrets)

```
# Edit .env with your secrets first
vim .env

# Push to Infisical with environment selection
mojocli push --env=dev
mojocli push --env=staging
mojocli push --env=prod

# Interactive environment selection (if no --env specified)
mojocli push
```

### Help

[](#help)

```
mojocli help
```

🔄 Complete Workflow
-------------------

[](#-complete-workflow)

### Project Setup

[](#project-setup)

```
# Initialize project with specific environment
mojocli init --name="My Awesome Project" --env="dev"

# Fetch secrets for development
mojocli pull --env=dev --output=.env.local

# Export to current shell
export $(cat .env.local | xargs)
```

### Development

[](#development)

```
# Edit secrets locally
vim .env

# Push changes to Infisical
mojocli push --env=dev

# Fetch latest secrets
mojocli pull --env=dev --output=.env.local
```

### Multi-Environment Setup

[](#multi-environment-setup)

```
# Initialize project
mojocli init --name="My Project" --env="dev"

# Fetch secrets for different environments
mojocli pull --env=dev --output=.env.dev
mojocli pull --env=staging --output=.env.staging
mojocli pull --env=prod --output=.env.prod

# Use appropriate environment file
export $(cat .env.dev | xargs)      # For development
export $(cat .env.staging | xargs)  # For staging
export $(cat .env.prod | xargs)     # For production
```

🛠️ Local Development
--------------------

[](#️-local-development)

### Test Commands

[](#test-commands)

```
# Test help
php bin/mojocli help

# Test init with environment
php bin/mojocli init --name="Test Project" --env="dev"

# Test fetch with environment
php bin/mojocli pull --env=dev --output=.env.local

# Test push
php bin/mojocli push --env=dev
```

🏗️ Configuration
----------------

[](#️-configuration)

### Files Created

[](#files-created)

- **`infisical.json`** - Project configuration (safe to commit)
- **`.env.local`** - Fetched secrets (add to .gitignore)
- **`.env`** - Local secrets for pushing (add to .gitignore)

### Environment Variables Required

[](#environment-variables-required)

- **`INFISICAL_CLIENT_ID`** - Your Infisical client ID
- **`INFISICAL_CLIENT_SECRET`** - Your Infisical client secret

### Environment Selection

[](#environment-selection)

The tool supports three environments:

- **dev** (development) - Default
- **staging** - For staging environment
- **prod** (production) - For production environment

Environment can be specified via `--env` parameter or selected interactively.

**Supported environment values:**

- CLI accepts: `dev`, `development`, `staging`, `stage`, `prod`, `production`
- API uses: `dev`, `staging`, `prod` (automatically normalized)

### Hardcoded Settings

[](#hardcoded-settings)

- **API URL**: `https://secret.mojomosaic.com` (same for all environments)

🔒 Security Notes
----------------

[](#-security-notes)

- Never commit `.env` or `.env.local` files
- Set environment variables in your shell profile, not in code
- Use different client credentials for different environments
- Rotate credentials regularly
- Environment variables must be set before running any commands

🐛 Troubleshooting
-----------------

[](#-troubleshooting)

### Authentication Errors

[](#authentication-errors)

```
# Error: INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET must be set

# Temporary fix (current session only):
export INFISICAL_CLIENT_ID="your-actual-client-id"
export INFISICAL_CLIENT_SECRET="your-actual-client-secret"

# Permanent fix (add to shell profile):
echo 'export INFISICAL_CLIENT_ID="your-actual-client-id"' >> ~/.zshrc
echo 'export INFISICAL_CLIENT_SECRET="your-actual-client-secret"' >> ~/.zshrc
source ~/.zshrc

# Verify they're saved:
grep "INFISICAL" ~/.zshrc
```

### Environment Variables Not Loaded

[](#environment-variables-not-loaded)

```
# Reload your shell profile
source ~/.zshrc    # or ~/.bashrc

# Or restart your terminal
```

### Invalid Credentials (401 Error)

[](#invalid-credentials-401-error)

- Verify your credentials are correct
- Check that environment variables are properly set: `echo $INFISICAL_CLIENT_ID`
- Ensure no truncated values in your shell profile

### Windows-Specific Issues

[](#windows-specific-issues)

#### Command Not Found on Windows

[](#command-not-found-on-windows)

```
# Error: 'mojocli' is not recognized as the name of a cmdlet

# Check if Composer bin directory is in PATH:
echo $env:PATH

# Find Composer global bin directory:
composer global config bin-dir --absolute

# Add to PATH (typical path):
# Add C:\Users\YourUsername\AppData\Roaming\Composer\vendor\bin to system PATH

# Alternative: Run directly with full path:
C:\Users\YourUsername\AppData\Roaming\Composer\vendor\bin\mojocli help

# Restart PowerShell after updating PATH
```

#### Windows Environment Variables

[](#windows-environment-variables)

```
# Set environment variables in PowerShell:
$env:INFISICAL_CLIENT_ID = "your-client-id"
$env:INFISICAL_CLIENT_SECRET = "your-client-secret"

# For permanent setup, add to Windows Environment Variables via:
# System Properties > Advanced > Environment Variables
# Or use PowerShell profile:
notepad $PROFILE
# Add the export commands above to your PowerShell profile
```

### SSL Certificate Issues

[](#ssl-certificate-issues)

#### Self-Hosted Infisical Instances

[](#self-hosted-infisical-instances)

```
# Error: SSL certificate problem: unable to get local issuer certificate
# Error: cURL error: SSL certificate problem

# Quick fix - Bypass SSL verification (less secure):
export CURL_INSECURE=1
# Windows PowerShell:
$env:CURL_INSECURE = "1"

# Then retry your command:
mojocli init --name="Project Name"
```

#### SSL Certificate Solutions

[](#ssl-certificate-solutions)

**Option 1: Update CA Certificates (Recommended)**

```
# Download latest CA bundle:
curl -o cacert.pem https://curl.se/ca/cacert.pem

# Set CA bundle path:
export CURL_CA_BUNDLE="/path/to/cacert.pem"
# Windows:
$env:CURL_CA_BUNDLE = "C:\path\to\cacert.pem"
```

**Option 2: Configure for Self-Hosted HTTP**

```
# If your instance uses HTTP instead of HTTPS:
export INFISICAL_URL="http://your-infisical-domain.com"
# Windows:
$env:INFISICAL_URL = "http://your-infisical-domain.com"
```

**Option 3: Add Self-Signed Certificate (Windows)**

1. Visit your Infisical instance in browser
2. Click the padlock → Certificate → Details → Copy to File
3. Save as .cer file
4. Double-click the .cer file → Install Certificate
5. Choose "Local Machine" → "Trusted Root Certification Authorities"
6. Restart your terminal

**Option 4: Use Official Infisical CLI**

```
# Install official CLI (better SSL handling):
npm install -g @infisical/cli

# Login to self-hosted instance:
infisical login --domain=your-infisical-domain.com
```

### Network and Connectivity Issues

[](#network-and-connectivity-issues)

#### Proxy/Corporate Network

[](#proxycorporate-network)

```
# If behind corporate proxy:
export HTTP_PROXY="http://proxy.company.com:8080"
export HTTPS_PROXY="http://proxy.company.com:8080"
# Windows:
$env:HTTP_PROXY = "http://proxy.company.com:8080"
$env:HTTPS_PROXY = "http://proxy.company.com:8080"
```

#### Firewall Issues

[](#firewall-issues)

- Ensure outbound HTTPS (443) access to your Infisical instance
- Check if your network blocks external API calls
- Contact IT if corporate firewall blocks connections

### Debug Mode

[](#debug-mode)

```
# Enable verbose output for debugging:
export DEBUG=1
# Windows:
$env:DEBUG = "1"

# Then run your command to see detailed error information
mojocli init --name="Project Name"
```

📄 License
---------

[](#-license)

MIT

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance63

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

222d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e0b47f05e4236bedac0ae6c31077cf593002fce4efd33df4bedb770fb5a8f60?d=identicon)[zainzulifqar](/maintainers/zainzulifqar)

---

Top Contributors

[![mzainzulifqar](https://avatars.githubusercontent.com/u/50246160?v=4)](https://github.com/mzainzulifqar "mzainzulifqar (6 commits)")

---

Tags

cliautomationdevopssecretsmojo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mojo-cli/health.svg)

```
[![Health](https://phpackages.com/badges/mojo-cli/health.svg)](https://phpackages.com/packages/mojo-cli)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[nategood/commando

PHP CLI Commando Style

8123.3M38](/packages/nategood-commando)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
