Skip to content

Commit

Permalink
initial setup of the package
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhas committed Dec 6, 2021
1 parent 1ee8be7 commit f91bccf
Show file tree
Hide file tree
Showing 30 changed files with 318 additions and 377 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: worksome
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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/worksome/feature-flags/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/worksome/feature-flags/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/:vendor_name/:package_name/security/policy
url: https://github.com/worksome/feature-flags/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/:vendor_name/:package_name/issues/new
url: https://github.com/worksome/feature-flags/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@domain.com instead of using the issue tracker.
If you discover any security related issues, please email lukas@worksome.com 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 `feature-flags` 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@domain.com>
Copyright (c) worksome <lukas@worksome.com>

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
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@
# :package_description
# A package to manage feature flags in your application

---
This repo can be used to scaffold a Laravel package. Follow these steps to get started:
A package to manage feature flags in your application. Currently supporting these providers:

1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files
3. Remove this block of text.
4. Have fun creating your package.
5. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
---

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
- [LaunchDarkly](https://launchdarkly.com/)

## Installation

You can install the package via composer:

```bash
composer require :vendor_slug/:package_slug
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag=":package_slug_without_prefix-migrations"
php artisan migrate
composer require worksome/feature-flags
```

You can publish the config file with:
```bash
php artisan vendor:publish --tag=":package_slug_without_prefix-config"
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="example-views"
php artisan vendor:publish --tag="feature-flags_without_prefix-config"
```

This is the contents of the published config file:

```php
use Worksome\FeatureFlags\ModelFeatureFlagConvertor;

// config for Worksome/FeatureFlags
return [
'default' => env('FEATURE_FLAGS_PROVIDER', 'launchdarkly'),

'convertor' => ModelFeatureFlagConvertor::class,

'providers' => [
'launchdarkly' => [
'key' => env('LAUNCHDARKLY_SDK_KEY'),
'options' => [
/**
* https://docs.launchdarkly.com/sdk/features/offline-mode
*/
'offline' => env('LAUNCHDARKLY_OFFLINE', false)
]
]
]
];
```

## Usage
## Usage in Blade

```php
$skeleton = new VendorName\Skeleton();
echo $skeleton->echoPhrase('Hello, VendorName!');
@feature('feature-flag')
This is content under a featre flag.
@endfeature
```

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

## Credits

- [:author_name](https://github.com/:author_username)
- [Lukas Juhas](https://github.com/lukasjuhas)
- [All Contributors](../../contributors)

## License
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": ":vendor_slug/:package_slug",
"description": ":package_description",
"name": "worksome/feature-flags",
"description": "A package to manage feature flags in your application",
"keywords": [
":vendor_name",
"worksome",
"laravel",
":package_slug"
"feature-flags"
],
"homepage": "https://github.com/:vendor_slug/:package_slug",
"homepage": "https://github.com/worksome/feature-flags",
"license": "MIT",
"authors": [
{
"name": ":author_name",
"email": "author@domain.com",
"name": "Lukas Juhas",
"email": "lukas@worksome.com",
"role": "Developer"
}
],
"require": {
"php": "^8.0|^8.1",
"spatie/laravel-package-tools": "^1.9.2",
"illuminate/contracts": "^8.73"
"illuminate/contracts": "^8.73",
"launchdarkly/server-sdk": "^4.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"nunomaduro/collision": "^5.10",
Expand All @@ -31,13 +32,12 @@
},
"autoload": {
"psr-4": {
"VendorName\\Skeleton\\": "src",
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories"
"Worksome\\FeatureFlags\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"VendorName\\Skeleton\\Tests\\": "tests"
"Worksome\\FeatureFlags\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -58,10 +58,10 @@
"extra": {
"laravel": {
"providers": [
"VendorName\\Skeleton\\SkeletonServiceProvider"
"Worksome\\FeatureFlags\\FeatureFlagsServiceProvider"
],
"aliases": {
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
"FeatureFlags": "Worksome\\FeatureFlags\\Facades\\FeatureFlags"
}
}
},
Expand Down
21 changes: 21 additions & 0 deletions config/feature-flags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
use Worksome\FeatureFlags\ModelFeatureFlagConvertor;

// config for Worksome/FeatureFlags
return [
'default' => env('FEATURE_FLAGS_PROVIDER', 'launchdarkly'),

'convertor' => ModelFeatureFlagConvertor::class,

'providers' => [
'launchdarkly' => [
'key' => env('LAUNCHDARKLY_SDK_KEY'),
'options' => [
/**
* https://docs.launchdarkly.com/sdk/features/offline-mode
*/
'offline' => env('LAUNCHDARKLY_OFFLINE', false)
]
]
]
];
5 changes: 0 additions & 5 deletions config/skeleton.php

This file was deleted.

Loading

0 comments on commit f91bccf

Please sign in to comment.