diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b611f472..fcab6b2b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,31 +1,217 @@ -* @SonsOfPHP/Members +# If nothing matches, assign to me +* @JoshuaEstes -# Make Documentation Team -docs/ @JoshuaEstes +# Default documentation owner +/docs @JoshuaEstes -# Each project needs a Team +# ============================================================================== + +# bard /src/SonsOfPHP/Bard @JoshuaEstes +/docs/bard @JoshuaEstes + +# ============================================================================== + +# assert +/src/SonsOfPHP/*/Assert @JoshuaEstes +/docs/*/assert @JoshuaEstes + +# autoloader +/src/SonsOfPHP/*/Autoloader @JoshuaEstes +/docs/*/autoloader @JoshuaEstes + +# barcode +/src/SonsOfPHP/*/Barcode @JoshuaEstes +/docs/*/barcode @JoshuaEstes + +# cache +/src/SonsOfPHP/*/Cache @JoshuaEstes +/docs/*/cache @JoshuaEstes + +# clock +/src/SonsOfPHP/*/Clock @JoshuaEstes +/docs/*/clock @JoshuaEstes + +# config +/src/SonsOfPHP/*/Config @JoshuaEstes +/docs/*/config @JoshuaEstes + +# container +/src/SonsOfPHP/*/Container @JoshuaEstes +/docs/*/container @JoshuaEstes + +# cookie +/src/SonsOfPHP/*/Cookie @JoshuaEstes +/docs/*/cookie @JoshuaEstes + +# cqrs +/src/SonsOfPHP/*/Cqrs @JoshuaEstes +/docs/*/cqrs @JoshuaEstes + +# crypt +/src/SonsOfPHP/*/Crypt @JoshuaEstes +/docs/*/crypt @JoshuaEstes + +# csv +/src/SonsOfPHP/*/Csv @JoshuaEstes +/docs/*/csv @JoshuaEstes + +# dotenv +/src/SonsOfPHP/*/Dotenv @JoshuaEstes +/docs/*/dotenv @JoshuaEstes + +# error-handler +/src/SonsOfPHP/*/ErrorHandler @JoshuaEstes +/docs/*/error-handler @JoshuaEstes + +# event-dispatcher +/src/SonsOfPHP/*/EventDispatcher @JoshuaEstes +/docs/*/event-dispatcher @JoshuaEstes + +# event-sourcing +/src/SonsOfPHP/*/EventSourcing @JoshuaEstes +/src/SonsOfPHP/Bundle/EventSourcingBundle @JoshuaEstes +/docs/*/event-sourcing @JoshuaEstes + +# feature-toggle +/src/SonsOfPHP/*/FeatureToggle @JoshuaEstes +/src/SonsOfPHP/Bundle/FeatureToggleBundle @JoshuaEstes +/docs/*/feature-toggle @JoshuaEstes + +# file +/src/SonsOfPHP/*/File @JoshuaEstes +/docs/*/file @JoshuaEstes + +# filesystem +/src/SonsOfPHP/*/Filesystem @JoshuaEstes +/src/SonsOfPHP/Bridge/Aws/Filesystem @JoshuaEstes +/src/SonsOfPHP/Bridge/LiipImagine/Filesystem @JoshuaEstes +/src/SonsOfPHP/Bundle/FilesystemBundle @JoshuaEstes +/docs/*/filesystem @JoshuaEstes + +# form +/src/SonsOfPHP/*/Form @JoshuaEstes +/docs/*/form @JoshuaEstes + +# http-client +/src/SonsOfPHP/*/HttpClient @JoshuaEstes +/docs/*/http-client @JoshuaEstes + +# http-factory +/src/SonsOfPHP/*/HttpFactory @JoshuaEstes +/docs/*/http-factory @JoshuaEstes + +# http-handler +/src/SonsOfPHP/*/HttpHandler @JoshuaEstes +/docs/*/http-handler @JoshuaEstes + +# http-message +/src/SonsOfPHP/*/HttpMessage @JoshuaEstes +/docs/*/http-message @JoshuaEstes + +# internationalization +/src/SonsOfPHP/*/Internationalization @JoshuaEstes +/docs/*/internationalization @JoshuaEstes + +# json +/src/SonsOfPHP/*/Json @JoshuaEstes +/docs/*/json @JoshuaEstes + +# link +/src/SonsOfPHP/*/Link @JoshuaEstes +/docs/*/link @JoshuaEstes + +# lock +/src/SonsOfPHP/*/Lock @JoshuaEstes +/docs/*/lock @JoshuaEstes + +# logger +/src/SonsOfPHP/*/Logger @JoshuaEstes +/src/SonsOfPHP/Bundle/LoggerBundle @JoshuaEstes +/docs/*/logger @JoshuaEstes + +# mailer +/src/SonsOfPHP/*/Mailer @JoshuaEstes +/src/SonsOfPHP/Bundle/MailerBundle @JoshuaEstes +/docs/*/mailer @JoshuaEstes + +# math +/src/SonsOfPHP/*/Math @JoshuaEstes +/docs/*/math @JoshuaEstes + +# message-bus +/src/SonsOfPHP/*/MessageBus @JoshuaEstes +/docs/*/message-bus @JoshuaEstes + +# mime +/src/SonsOfPHP/*/Mime @JoshuaEstes +/docs/*/mime @JoshuaEstes + +# money +/src/SonsOfPHP/*/Money @JoshuaEstes +/src/SonsOfPHP/Bridge/Twig/Money @JoshuaEstes +/src/SonsOfPHP/Bundle/MoneyBundle @JoshuaEstes +/docs/*/money @JoshuaEstes + +# navigation +/src/SonsOfPHP/*/Navigation @JoshuaEstes +/docs/*/navigation @JoshuaEstes + +# pager +/src/SonsOfPHP/*/Pager @JoshuaEstes +/src/SonsOfPHP/Bridge/Doctrine/*/Pager @JoshuaEstes +/src/SonsOfPHP/Bundle/PagerBundle @JoshuaEstes +/docs/*/pager @JoshuaEstes + +# pay +/src/SonsOfPHP/*/Pay @JoshuaEstes +/docs/*/pay @JoshuaEstes + +# pdf +/src/SonsOfPHP/*/Pdf @JoshuaEstes +/docs/*/pdf @JoshuaEstes + +# phar +/src/SonsOfPHP/*/Phar @JoshuaEstes +/docs/*/phar @JoshuaEstes + +# phone-number +/src/SonsOfPHP/*/PhoneNumber @JoshuaEstes +/docs/*/phone-number @JoshuaEstes + +# router +/src/SonsOfPHP/*/Router @JoshuaEstes +/docs/*/router @JoshuaEstes + +# search +/src/SonsOfPHP/*/Search @JoshuaEstes +/docs/*/search @JoshuaEstes + +# serializer +/src/SonsOfPHP/*/Serializer @JoshuaEstes +/docs/*/serializer @JoshuaEstes + +# session +/src/SonsOfPHP/*/Session @JoshuaEstes +/docs/*/session @JoshuaEstes + +# state-machine +/src/SonsOfPHP/*/StateMachine @JoshuaEstes +/src/SonsOfPHP/Bundle/StateMachineBundle @JoshuaEstes +/docs/*/state-machine @JoshuaEstes + +# stdlib +/src/SonsOfPHP/*/Stdlib @JoshuaEstes +/docs/*/stdlib @JoshuaEstes + +# user-agent +/src/SonsOfPHP/*/UserAgent @JoshuaEstes +/docs/*/user-agent @JoshuaEstes + +# validator +/src/SonsOfPHP/*/Validator @JoshuaEstes +/docs/*/validator @JoshuaEstes -# Each component/contract needs a Team -/src/SonsOfPHP/**/Assert @JoshuaEstes -/src/SonsOfPHP/**/Cache @JoshuaEstes -/src/SonsOfPHP/**/Clock @JoshuaEstes -/src/SonsOfPHP/**/Container @JoshuaEstes -/src/SonsOfPHP/**/Cookie @JoshuaEstes -/src/SonsOfPHP/**/Common @JoshuaEstes -/src/SonsOfPHP/**/Cqrs @JoshuaEstes -/src/SonsOfPHP/**/EventDispatcher @JoshuaEstes -/src/SonsOfPHP/**/EventSourcing @JoshuaEstes -/src/SonsOfPHP/**/FeatureToggle @JoshuaEstes -/src/SonsOfPHP/**/Filesystem @JoshuaEstes -/src/SonsOfPHP/**/HttpFactory @JoshuaEstes -/src/SonsOfPHP/**/HttpHandler @JoshuaEstes -/src/SonsOfPHP/**/HttpMessage @JoshuaEstes -/src/SonsOfPHP/**/Json @JoshuaEstes -/src/SonsOfPHP/**/Link @JoshuaEstes -/src/SonsOfPHP/**/Logger @JoshuaEstes -/src/SonsOfPHP/**/Mailer @JoshuaEstes -/src/SonsOfPHP/**/Money @JoshuaEstes -/src/SonsOfPHP/**/Pager @JoshuaEstes -/src/SonsOfPHP/**/StateMachine @JoshuaEstes -/src/SonsOfPHP/**/Version @JoshuaEstes +# version +/src/SonsOfPHP/*/Version @JoshuaEstes +/docs/*/version @JoshuaEstes diff --git a/Makefile b/Makefile index 0925bde1..29c6a146 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # start: Executables -COMPOSER = composer -PHP = php +DOCKER_COMPOSE = docker compose +COMPOSER = composer +PHP = php # end: Executables # start: Tools @@ -83,7 +84,7 @@ clean: ## Remove all vendor folders, composer.lock files, and removes build arti rm -rf src/SonsOfPHP/Bundle/*/vendor/ src/SonsOfPHP/Bundle/*/composer.lock rm -rf src/SonsOfPHP/Component/*/vendor/ src/SonsOfPHP/Component/*/composer.lock rm -rf src/SonsOfPHP/Contract/*/vendor/ src/SonsOfPHP/Contract/*/composer.lock - rm -rf src/tools/*/vendor/ src/tools/*/composer.lock + @#rm -rf src/tools/*/vendor/ src/tools/*/composer.lock # This will upgrade the code to whatever the standards are # NOTE: This may make changes to the source code @@ -115,6 +116,19 @@ coverage: XDEBUG_MODE=coverage coverage: PHPUNIT_OPTIONS=--coverage-html $(COVERAGE_DIR) coverage: test ## Build Code Coverage Report +##---- Docker ------------------------------------------------------------------------- +.PHONY: docker-up +docker-up: ## Start containers + @$(DOCKER_COMPOSE) up --detach --remove-orphans + +.PHONY: docker-down +docker-down: ## Shutdown containers + @$(DOCKER_COMPOSE) down --remove-orphans + +.PHONY: docker-logs +docker-logs: ## Show live logs + @$(DOCKER_COMPOSE) logs --tail=0 --follow + ##---- Code Quality ------------------------------------------------------------------- .PHONY: lint lint: ## Lint PHP files diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..b94bf5e4 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,16 @@ +#### +# Various Services used for integration testing +#### +services: + aws: + image: localstack/localstack + ports: + - 4566:4566 + memcached: + image: memcached + ports: + - 11211:11211 + redis: + image: redis + ports: + - 6379:6379 diff --git a/docs/README.md b/docs/README.md index 9a67d4e6..a6404239 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,3 +34,53 @@ Please submit [Pull Requests](https://github.com/SonsOfPHP/sonsofphp/pulls) to t ### Getting Help Please visit the [Sons of PHP Organization Discussions](https://github.com/orgs/SonsOfPHP/discussions) section to ask questions and get more help. + +# About Sons of PHP + +Sons of PHP is a collection of various PHP projects that are split into +"Contracts" and "Components". After that, functionality is extended by using +"Bridges". Beyond that are plugins, bundles, and packages that are specifically +for various frameworks. + +The main focus of Sons of PHP is small re-usable components. + +## Contracts + +Everything starts with contracts. The contracts are NOT meant to replace PSR +standards. Contracts are where all the interfaces are stored. There is no +executable code here. Contracts are a way to provide other developers the +ability to create components using a standard interface. + +Contracts may also extend PSR standards as well as core PHP interfaces. + +Contracts are also meant to be standalone. They do not require any other +contracts other than PSRs. + +## Components + +All components will use the contracts to implement the code. These are the main +packages that you will use in your projects. + +Components are also meant to be standalone. Generally, there will be no +additional requirements. Some components may require other additional Sons of +PHP components, but for the most part, additional functionality is added by +Bridges. + +## Bridges + +A bridge will connect a Sons of PHP component to another library. For example, +the Pager component has additional packages that use Doctrine. The Filesystem +component also has an AWS S3 bridge that allows you to use AWS S3 buckets to +store files. + +## Bundles, Plugins, etc. + +Some frameworks out there (Symfony, Laravel, etc.) allow developers to install +bundles, plugins, etc. Sons of PHP has a few of these and the leverage the +various components and bridges. + +## Additional Standalone Projects + +Sons of PHP also has standalone projects such as Bard. These projects are +include many different Sons of PHP components and bridges, but also include +other libraries. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0ffd81c3..38b3dfe7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -17,92 +17,6 @@ src/SonsOfPHP/Bundle/*/Tests src/SonsOfPHP/Component/*/Tests - - - src/SonsOfPHP/Bard/Tests - - - - src/SonsOfPHP/Component/Clock/Tests - - - - src/SonsOfPHP/Component/Clock/Tests - - - - src/SonsOfPHP/Component/Container/Tests - - - - src/SonsOfPHP/Component/Cookie/Tests - - - - src/SonsOfPHP/Bridge/*/Cqrs/Tests - - - - - src/SonsOfPHP/Component/EventDispatcher/Tests - - - - src/SonsOfPHP/Bridge/*/EventSourcing/Tests - src/SonsOfPHP/Component/EventSourcing/Tests - - - - src/SonsOfPHP/Component/FeatureToggle/Tests - src/SonsOfPHP/Bridge/Aws/Filesystem/Tests - src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Tests - - - - src/SonsOfPHP/Component/Filesystem/Tests - - - - src/SonsOfPHP/Component/HttpFactory/Tests - - - - src/SonsOfPHP/Component/HttpHandler/Tests - - - - src/SonsOfPHP/Component/HttpMessage/Tests - - - - src/SonsOfPHP/Component/Json/Tests - - - - src/SonsOfPHP/Component/Link/Tests - - - - src/SonsOfPHP/Component/Logger/Tests - - - - src/SonsOfPHP/Component/Mailer/Tests - - - - src/SonsOfPHP/Bridge/*/Money/Tests - src/SonsOfPHP/Component/Money/Tests - - - - src/SonsOfPHP/Bridge/*/*/Pager/Tests - src/SonsOfPHP/Component/Pager/Tests - - - - src/SonsOfPHP/Component/Version/Tests - @@ -113,8 +27,8 @@ src/* - src/SonsOfPHP/Bard/Tests - src/SonsOfPHP/Bard/vendor + src/SonsOfPHP/*/Tests + src/SonsOfPHP/*/vendor src/SonsOfPHP/Bridge/*/*/*/Tests src/SonsOfPHP/Bridge/*/*/*/vendor src/SonsOfPHP/Bridge/*/*/Tests @@ -126,5 +40,4 @@ src/SonsOfPHP/Contract/*/vendor - diff --git a/src/SonsOfPHP/Bard/README.md b/src/SonsOfPHP/Bard/README.md index f8ff0d50..4ed72203 100644 --- a/src/SonsOfPHP/Bard/README.md +++ b/src/SonsOfPHP/Bard/README.md @@ -1,15 +1,18 @@ -Bard -==== +Sons of PHP - Bard +================== Bard is a tool that helps to manage monorepos. -* init = creates initial bard.json file -* merge = updates all the composer.json files -* validate = validates composer.json files -* split = updates read-only repositories -* release = bump deps, bump version, tag, git push, and updates repos -* changelog = manages changelogs +## Learn More -## bard.json +* [Documentation][docs] +* [Contributing][contributing] +* [Report Issues][issues] and [Submit Pull Requests][pull-requests] in the [Mother Repository][mother-repo] +* Get Help & Support using [Discussions][discussions] -### version +[discussions]: https://github.com/orgs/SonsOfPHP/discussions +[mother-repo]: https://github.com/SonsOfPHP/sonsofphp +[contributing]: https://docs.sonsofphp.com/contributing/ +[docs]: https://docs.sonsofphp.com/ +[issues]: https://github.com/SonsOfPHP/sonsofphp/issues?q=is%3Aopen+is%3Aissue+label%3ABard +[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls?q=is%3Aopen+is%3Apr+label%3ABard diff --git a/src/SonsOfPHP/Bundle/FeatureToggleBundle/README.md b/src/SonsOfPHP/Bundle/FeatureToggleBundle/README.md index dc962281..c9af64ec 100644 --- a/src/SonsOfPHP/Bundle/FeatureToggleBundle/README.md +++ b/src/SonsOfPHP/Bundle/FeatureToggleBundle/README.md @@ -1,23 +1,113 @@ -
- -
-
-
- - - -
+Sons of PHP - Feature Toggle Bundle +=================================== -# Sons of PHP +## Installation -Sons of PHP is builds reusable components and tools using PHP. +Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation. -* Documentation can be found at [docs.SonsOfPHP.com][docs] -* Please [Report Issues][issues] and send [Pull Requests][pull-requests] in the [Mother Repository][mother-repo] -* You can get more help by posting questions in the [GitHub Discussions][discussions] +### Applications that use Symfony Flex + +Open a command console, enter your project directory and execute: + +```sh +composer require sonsofphp/feature-toggle-bundle +``` + +### Applications that don't use Symfony Flex + +#### Step 1: Download the Bundle + +Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle: + +```sh +composer require sonsofphp/feature-toggle-bundle +``` + +#### Step 2: Enable the Bundle + +Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project: + +```php +// config/bundles.php + +return [ + // ... + SonsOfPHP\Bundle\FeatureToggleBundle\SonsOfPHPFeatureToggleBundle::class => ['all' => true], +]; +``` + +## Configuration + +```yaml +# config/packages/sons_of_php_feature_toggle.yaml +sons_of_php_feature_toggle: + features: + # You can create as many features as you want + enabled_key: + # Features can be enabled, disabled, or use a custom toggle + toggle: enabled + disabled_key: + toggle: disabled + custom_toggle_key: + toggle: app.toggle.admin_users +``` + +## Debug Command + +You can debug your features by running the `debug:features` command. + +```sh +php bin/console debug:features +``` + +This will give you a list of features and the toggles they are using. + +## Twig Templates + +You can check to see if the feature is enabled in twig templates by using the `is_feature_enabled` function. + +```twig +{% raw %} +{% if is_feature_enabled('enabled_key') %} + Feature "enabled_key" is enabled +{% else %} + Feature "enabled_key" is disabled +{% endif %} +{% endraw %} +``` + +## Services + +```php +get('enabled_key')->isEnabled()) { + // "enabled_key" is enabled + } + } +} +``` + +## Learn More + +* [Documentation][docs] +* [Contributing][contributing] +* [Report Issues][issues] and [Submit Pull Requests][pull-requests] in the [Mother Repository][mother-repo] +* Get Help & Support using [Discussions][discussions] -[mother-repo]: "Sons of PHP Mother Repository" [discussions]: https://github.com/orgs/SonsOfPHP/discussions -[issues]: https://github.com/SonsOfPHP/sonsofphp/issues -[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls -[docs]: https://docs.sonsofphp.com +[mother-repo]: https://github.com/SonsOfPHP/sonsofphp +[contributing]: https://docs.sonsofphp.com/contributing/ +[docs]: https://docs.sonsofphp.com/ +[issues]: https://github.com/SonsOfPHP/sonsofphp/issues?q=is%3Aopen+is%3Aissue+label%3AFeatureToggle +[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls?q=is%3Aopen+is%3Apr+label%3AFeatureToggle