A small but powerful Laravel Artisan command that uses Laravel Prompts to interactively ask for a GitHub username and display useful GitHub statistics directly in the terminal.
This project is ideal for learning how to:
- Build custom Artisan commands
- Use Laravel Prompts for interactive CLI experiences
- Consume the GitHub public API
- Present data visually in the terminal
- 🔍 Prompt for a GitHub username using Laravel Prompts
- 📦 Display total public repositories
- 🔢 Show approximate commit count (from recent activity)
- 🧠 Detect most used programming language
- 📊 Render a simple weekly commit graph in the terminal
- ⚡ Fast, lightweight, and API-friendly
- 🧪 Uses only GitHub public endpoints (no authentication required)
- PHP 8.1+
- Laravel 10+
- Internet connection (for GitHub API access)
Clone the repository:
git clone https://github.com/usenmfon/github-stats-artisan.git
cd github-stats-artisancomposer install
php artisan key:generate
php artisan github:stats
Enter GitHub username: octocat
GitHub Stats for: octocat
---------------------------------
Public Repositories: 8
Approximate Commits (last 7 days): 24
Most Used Language: JavaScript
Weekly Commit Activity:
Mon ████
Tue ██████
Wed ██
Thu █████
Fri ███
Sat █
Sun ████
🧠 How It Works
-
Laravel Prompts collects the GitHub username interactively
-
GitHub public API endpoints are queried:
-
User profile
-
Repositories
-
Recent public events
-
Repository languages are aggregated to determine the most used language
-
Commit activity is grouped by weekday
-
Output is rendered using terminal-friendly formatting
app/
└── Console/
└── Commands/
└── GithubStatsCommand.php
cp .env.example .env
-
Commit counts are approximate
-
Private repositories and commits are excluded
-
GitHub API rate limits apply to unauthenticated requests
Run the command manually:
php artisan github:stats
This project is open-source and licensed under the MIT License.