forked from caneco/laravel-github-profile-view-counter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
184 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Spatie bvba <[email protected]> | ||
Copyright (c) Caneco bvba <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,39 @@ | ||
# :package_description | ||
# Laravel GitHub Profile Visit Counter | ||
|
||
[](https://packagist.org/packages/spatie/:package_name) | ||
[](https://github.com/spatie/:package_name/actions?query=workflow%3Arun-tests+branch%3Amaster) | ||
[](https://packagist.org/packages/spatie/:package_name) | ||
<p align="center"> | ||
<img src="/art/socialcard.png" width="1280" title="Social Card Laravel GitHub Profile View Counter"> | ||
<p align="center"> | ||
<a href="https://packagist.org/packages/caneco/laravel-github-profile-view-counter"><img alt="Total Downloads" src="https://img.shields.io/packagist/dt/caneco/laravel-github-profile-view-counter"></a> | ||
<a href="https://packagist.org/packages/caneco/laravel-github-profile-view-counter"><img alt="License" src="https://img.shields.io/packagist/l/caneco/laravel-github-profile-view-counter"></a> | ||
</p> | ||
</p> | ||
|
||
**Note:** Replace ```:author_name``` ```:author_username``` ```:author_email``` ```:package_name``` ```:package_description``` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md) and [composer.json](composer.json) files, then delete this line. You can also run `configure-skeleton.sh` to do this automatically. | ||
This package will allows you to track Github profile views and display them in your profile readme, for free. | ||
|
||
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. | ||
|
||
## Support us | ||
|
||
Learn how to create a package like this one, by watching our premium video course: | ||
|
||
[](https://laravelpackage.training) | ||
|
||
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). | ||
|
||
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). | ||
This package was inspired Artem Golubin's post [**How to track and display profile views on GitHub**](https://rushter.com/blog/github-profile-markdown/). | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require spatie/package-skeleton-laravel | ||
composer require caneco/laravel-github-profile-view-counter | ||
``` | ||
|
||
You can publish and run the migrations with: | ||
|
||
```bash | ||
php artisan vendor:publish --provider="Spatie\Skeleton\SkeletonServiceProvider" --tag="migrations" | ||
php artisan vendor:publish --provider="Caneco\GithubProfileViewCounter\GithubProfileViewCounterServiceProvider" --tag="migrations" | ||
php artisan migrate | ||
``` | ||
|
||
You can publish the config file with: | ||
```bash | ||
php artisan vendor:publish --provider="Spatie\Skeleton\SkeletonServiceProvider" --tag="config" | ||
``` | ||
|
||
This is the contents of the published config file: | ||
## Usage | ||
|
||
```php | ||
return [ | ||
]; | ||
``` | ||
Just visit `yourdomain.com/github-profile-view-counter.svg`, you should see your badge with `visits++`. | ||
|
||
## Usage | ||
## Cheating | ||
|
||
``` php | ||
$skeleton = new Spatie\Skeleton(); | ||
echo $skeleton->echoPhrase('Hello, Spatie!'); | ||
``` | ||
You can always fill your table with a lot of rows to make yourself famous! **But, play nice** 😉. | ||
|
||
## Testing | ||
|
||
|
@@ -66,15 +49,15 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re | |
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [:author_name](https://github.com/:author_username) | ||
- [Caneco](https://github.com/caneco) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
## Thanks | ||
|
||
Thanks to Spatie to make damn easy to create a new package. Please do check their [`spatie/package-skeleton-laravel`](https://github.com/spatie/package-skeleton-laravel). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<svg aria-label="Profile views: {{ $count ?? 0 }}" xmlns="http://www.w3.org/2000/svg" height="20" width="140"> | ||
<title>Profile views: {{ $count ?? 0 }}</title> | ||
<g shape-rendering="crispEdges"> | ||
<rect height="20" fill="#555" width="140"/> | ||
<rect height="20" fill="#4c1" x="80" width="60"/> | ||
<rect rx="3" width="80" height="20" fill="transparent"/> | ||
</g> | ||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11"> | ||
<text y="14" x="38">Profile views</text> | ||
<text y="14" x="110">{{ $count ?? 0 }}</text> | ||
</g> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
use Caneco\GithubProfileViewCounter\Http\Controllers\GithubProfileViewCounterController; | ||
|
||
Route::get('github-profile-view-counter.svg', GithubProfileViewCounterController::class); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Caneco\GithubProfileViewCounter; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Counter extends Model | ||
{ | ||
protected $fillable = ['ua', 'ip']; | ||
|
||
protected $table = 'x_github_profile_view_counter'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Caneco\GithubProfileViewCounter; | ||
|
||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class GithubProfileViewCounterServiceProvider extends ServiceProvider | ||
{ | ||
public function boot() | ||
{ | ||
$this->registerRoutes(); | ||
$this->registerResources(); | ||
} | ||
|
||
public function register() | ||
{ | ||
$this->offerPublishing(); | ||
} | ||
|
||
protected function registerRoutes() | ||
{ | ||
Route::group([ | ||
'middleware' => 'web', | ||
], function () { | ||
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); | ||
}); | ||
} | ||
|
||
protected function registerResources() | ||
{ | ||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'github-profile-view-counter'); | ||
} | ||
|
||
protected function offerPublishing() | ||
{ | ||
if ($this->app->runningInConsole()) { | ||
$this->publishes([ | ||
__DIR__ . '/../database/migrations/create_github_profile_view_counter_table.php.stub' | ||
=> database_path('migrations/' . date('Y_m_d_His', time()) . '_create_github_profile_view_counter_table.php'), | ||
], 'migrations'); | ||
} | ||
} | ||
} |
Oops, something went wrong.