Skip to content

Commit

Permalink
initial commit for snowflake, added snowflake singleton and HasSnowfl…
Browse files Browse the repository at this point in the history
…ake primary trait
  • Loading branch information
danieljaniga committed Feb 6, 2021
1 parent 2f132e4 commit 29bc4f5
Show file tree
Hide file tree
Showing 23 changed files with 147 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: :vendor_name
github: pixwell-dev
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
url: https://github.com/pixwell-dev/laravel-snowflake/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
url: https://github.com/pixwell-dev/laravel-snowflake/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a bug
url: https://github.com/:vendor_name/:package_name/issues/new
url: https://github.com/pixwell-dev/laravel-snowflake/issues/new
about: Report a reproducable bug
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security Policy

If you discover any security related issues, please email :author_email instead of using the issue tracker.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `:package_name` will be documented in this file.
All notable changes to `laravel-snowflake` will be documented in this file.

## 1.0.0 - 202X-XX-XX

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) :vendor_name <:author_email>
Copyright (c) pixwell-dev <[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
Expand Down
35 changes: 10 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# :package_description
# laravel-snowflake

[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_name/:package_name.svg?style=flat-square)](https://packagist.org/packages/:vendor_name/:package_name)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/:vendor_name/:package_name/run-tests?label=tests)](https://github.com/:vendor_name/:package_name/actions?query=workflow%3ATests+branch%3Amaster)
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_name/:package_name.svg?style=flat-square)](https://packagist.org/packages/:vendor_name/:package_name)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/pixwell-dev/laravel-snowflake.svg?style=flat-square)](https://packagist.org/packages/pixwell-dev/laravel-snowflake)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/pixwell-dev/laravel-snowflake/run-tests?label=tests)](https://github.com/pixwell-dev/laravel-snowflake/actions?query=workflow%3ATests+branch%3Amaster)
[![Total Downloads](https://img.shields.io/packagist/dt/pixwell-dev/laravel-snowflake.svg?style=flat-square)](https://packagist.org/packages/pixwell-dev/laravel-snowflake)

**Note:** Run `./configure-skeleton` to get started, or manually replace ```:author_name``` ```:author_username``` ```:author_email``` ```:vendor_name``` ```:package_name``` ```:package_description``` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](.github/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 is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/package-skeleton-laravel.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/package-skeleton-laravel)
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/package-laravel-snowflake-laravel.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/package-laravel-snowflake-laravel)

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).

Expand All @@ -21,33 +20,19 @@ We highly appreciate you sending us a postcard from your hometown, mentioning wh
You can install the package via composer:

```bash
composer require :vendor_name/:package_name
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --provider="Spatie\Skeleton\SkeletonServiceProvider" --tag=":package_name-migrations"
php artisan migrate
composer require pixwell-dev/laravel-snowflake
```

You can publish the config file with:
```bash
php artisan vendor:publish --provider="Spatie\Skeleton\SkeletonServiceProvider" --tag=":package_name-config"
```

This is the contents of the published config file:

```php
return [
];
php artisan vendor:publish --provider="PixwellDev\LaravelSnowflake\LaravelSnowflakeServiceProvider" --tag="laravel-snowflake-config"
```

## Usage

```php
$skeleton = new Spatie\Skeleton();
echo $skeleton->echoPhrase('Hello, Spatie!');
$laravel-snowflake = new PixwellDev\LaravelSnowflake();
echo $laravel-snowflake->echoPhrase('Hello, Pixwell-dev!');
```

## Testing
Expand All @@ -70,7 +55,7 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [:author_name](https://github.com/:author_username)
- [Daniel Janiga](https://github.com/danieljaniga)
- [All Contributors](../../contributors)

## License
Expand Down
29 changes: 15 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": ":vendor_name/:package_name",
"description": ":package_description",
"name": "pixwell-dev/laravel-snowflake",
"description": "laravel-snowflake",
"keywords": [
":vendor_name",
":package_name"
"pixwell-dev",
"laravel-snowflake"
],
"homepage": "https://github.com/:vendor_name/:package_name",
"homepage": "https://github.com/pixwell-dev/laravel-snowflake",
"license": "MIT",
"authors": [
{
"name": ":author_name",
"email": ":author_email",
"name": "Daniel Janiga",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": "^7.4|^8.0",
"spatie/laravel-package-tools": "^1.1",
"illuminate/contracts": "^8.0"
"godruoyi/php-snowflake": "^1.0",
"illuminate/contracts": "^8.0",
"spatie/laravel-package-tools": "^1.1"
},
"require-dev": {
"orchestra/testbench": "^6.0",
Expand All @@ -27,13 +28,13 @@
},
"autoload": {
"psr-4": {
"Spatie\\Skeleton\\": "src",
"Spatie\\Skeleton\\Database\\Factories\\": "database/factories"
"PixwellDev\\LaravelSnowflake\\": "src",
"PixwellDev\\LaravelSnowflake\\Database\\Factories\\": "database/factories"
}
},
"autoload-dev": {
"psr-4": {
"Spatie\\Skeleton\\Tests\\": "tests"
"PixwellDev\\LaravelSnowflake\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -47,10 +48,10 @@
"extra": {
"laravel": {
"providers": [
"Spatie\\Skeleton\\SkeletonServiceProvider"
"PixwellDev\\LaravelSnowflake\\LaravelSnowflakeServiceProvider"
],
"aliases": {
"Skeleton": "Spatie\\Skeleton\\SkeletonFacade"
"LaravelSnowflake": "PixwellDev\\LaravelSnowflake\\LaravelSnowflakeFacade"
}
}
},
Expand Down
5 changes: 0 additions & 5 deletions config/skeleton.php

This file was deleted.

33 changes: 33 additions & 0 deletions config/snowflake.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Snowflake Epoch
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for snowflake. Set the date
| the application was develop started. Don't set the date of the future.
| If service starts to move, don't change.
|
| Available Settings: Y-m-d H:i:s
|
*/
'epoch' => env('SNOWFLAKE_EPOCH', '2021-02-01 00:00:00'),

/*
|--------------------------------------------------------------------------
| Snowflake Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for snowflake.
| If you are using multiple servers, please assign unique
| ID(1-31) for Snowflake.
|
| Available Settings: 1-31
|
*/
'worker_id' => env('SNOWFLAKE_WORKER_ID', 1),

'datacenter_id' => env('SNOWFLAKE_DATACENTER_ID', 1),
];
93 changes: 0 additions & 93 deletions configure-skeleton.sh

This file was deleted.

19 changes: 0 additions & 19 deletions database/factories/ModelFactory.php

This file was deleted.

19 changes: 0 additions & 19 deletions database/migrations/create_skeleton_table.php.stub

This file was deleted.

2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
verbose="true"
>
<testsuites>
<testsuite name="Spatie Test Suite">
<testsuite name="PixwellDev Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
Empty file removed resources/views/.gitkeep
Empty file.
17 changes: 0 additions & 17 deletions src/Commands/SkeletonCommand.php

This file was deleted.

16 changes: 16 additions & 0 deletions src/LaravelSnowflakeFacade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace PixwellDev\LaravelSnowflake;

use Illuminate\Support\Facades\Facade;

/**
* @see \PixwellDev\LaravelSnowflake\LaravelSnowflake
*/
class LaravelSnowflakeFacade extends Facade
{
protected static function getFacadeAccessor()
{
return 'snowflake';
}
}
Loading

0 comments on commit 29bc4f5

Please sign in to comment.