Awesome Open Source
Awesome Open Source

Github Readme Streak Stats

Display your total contributions, current streak,
and longest streak on your GitHub profile README

📃 Table of Contents

⚡ Quick setup

  1. Copy-paste the markdown below into your GitHub profile README
  2. Replace the value after ?user= with your GitHub username
[![GitHub Streak](https://github-readme-streak-stats.herokuapp.com/?user=DenverCoder1)](https://git.io/streak-stats)

Note: See below for information about deploying the app on your own

⚙ Demo Site

Here you can customize your Streak Stats card with a live preview.

http://github-readme-streak-stats.herokuapp.com/demo/

Demo Site

🖌 Themes

To enable a theme, append &theme= followed by the theme name to the end of the source url:

[![GitHub Streak](https://github-readme-streak-stats.herokuapp.com/?user=DenverCoder1&theme=dark)](https://git.io/streak-stats)
Theme Preview
default default
dark dark
highcontrast highcontrast
More themes! ğŸŽ¨ See a list of all available themes

If you have come up with a new theme you'd like to share with others, open an issue to add it!

🔧 Options

The user field is the only required option. All other fields are optional.

If the theme parameter is specified, any color customizations specified will be applied on top of the theme, overriding the theme's values.

Parameter Details Example
user GitHub username to show stats for DenverCoder1
theme The theme to apply (Default: default) dark, radical, etc. ğŸŽ¨âžœ
hide_border Make the border transparent (Default: false) true or false
background Background color hex code (without #) or css color
border Border color hex code (without #) or css color
stroke Stroke line color between sections hex code (without #) or css color
ring Color of the ring around the current streak hex code (without #) or css color
fire Color of the fire in the ring hex code (without #) or css color
currStreakNum Current streak number hex code (without #) or css color
sideNums Total and longest streak numbers hex code (without #) or css color
currStreakLabel Current streak label hex code (without #) or css color
sideLabels Total and longest streak labels hex code (without #) or css color
dates Date range text color hex code (without #) or css color

Example

[![GitHub Streak](https://github-readme-streak-stats.herokuapp.com/?user=denvercoder1&currStreakNum=2FD3EB&fire=pink&sideLabels=F00)](https://git.io/streak-stats)

ℹ️ How these stats are calculated

This tool uses the contribution graphs on your GitHub profile to calculate which days you have contributed.

To include contributions in private repositories, turn on the setting for "Private contributions" from the dropdown menu above the contribution graph on your profile page.

Contributions include commits, pull requests, and issues that you create in standalone repositories (Learn more about what is considered a contribution).

The longest streak is the highest number of consecutive days on which you have made at least one contribution.

The current streak is the number of consecutive days ending with the current day on which you have made at least one contribution. If you have made a contribution today, it will be counted towards the current streak, however, if you have not made a contribution today, the streak will only count days before today so that your streak will not be zero.

Note: You may need to wait up to 24 hours for new contributions to show up (Learn how contributions are counted)

📤 Deploying it on your own

If you can, it is preferable to host the files on your own server.

Doing this can lead to better uptime and more control over customization (you can modify the code for your usage).

You can deploy the PHP files on any website server with PHP installed or as a Heroku app.

Deploy Streak Stats instantly

heroku zeet

Deploying to Heroku

Step-by-step instructions for deploying to Heroku

  1. Sign in to Heroku or create a new account at https://heroku.com
  2. Click the Deploy button below

Deploy

  1. On the page that comes up, click "Deploy App" at the end of the form
  2. Once the app is deployed, click "Manage App" to go to the dashboard
  3. Visit the "Settings" tab and click "Reveal Config Vars"
  4. Visit this link to create a new Personal Access Token
  5. Scroll to the bottom and click "Generate token"
  6. Add the token as a Config Var with the key TOKEN and your username with the key USERNAME:

image

  1. Scroll down to the Domains section to find the URL you will use in place of github-readme-streak-stats.herokuapp.com
Deploying to Zeet

Step-by-step instructions for deploying to Zeet

  1. Sign in to Zeet or create a new account at https://zeet.co
  2. Click the Deploy button below

Deploy

  1. On the page that comes up, click "Deploy Now"
  2. Visit the "Settings" tab and scroll down to Environment Variables
  3. Visit this link to create a new Personal Access Token
  4. Scroll to the bottom and click "Generate token"
  5. Add the token to the environment variables with the label TOKEN and your username as USERNAME, then click Save.

image

  1. Click the Deployments tab to find the URL you will use in place of github-readme-streak-stats.herokuapp.com

🤗 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you have a way to improve this project.

Make sure your request is meaningful and you have tested the app locally before submitting a pull request.

Installing Requirements

Requirements

Linux

sudo apt-get install php
sudo apt-get install php-curl
sudo apt-get install composer

Windows

Install PHP from XAMPP or php.net

▶ How to install and run PHP using XAMPP (Windows)

📥 Download Composer

Clone the repository

git clone https://github.com/DenverCoder1/github-readme-streak-stats.git
cd github-readme-streak-stats

Authorization

To get the GitHub API to run locally you will need to provide a token.

  1. Visit this link to create a new Personal Access Token
  2. Scroll to the bottom and click "Generate token"
  3. Create a file config.php in the src directory and replace ghp_example123 with your token and DenverCoder1 with your username:
# /src/config.php
<?php
putenv("TOKEN=ghp_example123");
putenv("USERNAME=DenverCoder1");

Running the app locally

composer start

Open http://localhost:8000/?user=DenverCoder1 to run the project locally.

Open http://localhost:8000/demo/ to run the demo site.

Running the tests

Before you can run tests, PHPUnit must be installed. You can install it using Composer by running the following command.

composer install

Run the following command to run the PHPUnit test script which will verify that the tested functionality is still working.

composer test

🙋‍♂️ Support

💙 If you like this project, give it a ⭐ and share it with friends!

Youtube Sponsor with Github

☕ Buy me a coffee


Made with ❤️ and PHP

Powered by Heroku


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (16,628) 
github (758) 
serverless (661) 
dynamic (123) 
stats (78) 
profile (71) 
readme (66) 
github-profile (20) 
profile-readme (19)