Search by

fluxter / saas-provider-bundle

MKHSKYFluxter

The SaaS Provider Bundle for easy SaaS provisioning

Package info

github.com/Fluxter/symfony-saas-provider-bundle

Type:symfony-bundle

pkg:composer/fluxter/saas-provider-bundle

Statistics

Installs: 3 651

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 2

2.0.0-BETA5 2022-07-07 22:26 UTC

README

CI

The corresponding provider bundle for the Fluxter SaaS Consumer bundle

Requirements

  • PHP 8.2 or newer (Symfony 8 requires PHP 8.4)
  • Symfony 7 or 8
  • Doctrine ORM 2.17+ / 3 with DoctrineBundle 2.11+ / 3

How to install

composer require fluxter/saas-provider-bundle

How to implement

  1. Create a client entity, that implements the TenantInterface
  2. Create a Client Parameter entity, that implements SaasClientParameterInterface
  3. Configure the bundle
    # config/packages/saas_provider.yaml
    saas_provider:
      client_entity: App\Entity\Tenant
      # Optional: host that works without a tenant (e.g. the landing page / sign up)
      global_url: app.yourdomain.tld
      # Optional: regular expressions of routes that also work without a tenant
      exclude_routes:
        - '^_profiler'
        - '^_wdt'
  4. Configure your firewall to the correct voter mode
    # config/packages/security.yaml
    security:
        access_decision_manager:
            strategy: unanimous
            allow_if_all_abstain: false

Development

Everything runs inside the dev container (.devcontainer/), so only Docker is needed, no local PHP. You can also open the project in VS Code with the "Dev Containers" extension.

make help                          # list all targets
make install                       # composer install
make tests                         # run the PHPUnit test suite
make composer c="require foo/bar"  # run any composer command
make shell                         # open a shell in the container
make lint                          # check coding standards (make fix to fix them)

Test against a specific PHP / Symfony version (like the GitHub Actions matrix does):

make update tests PHP_VERSION=8.2 SYMFONY=7.4
make matrix   # every PHP / Symfony combination
make lowest   # lowest supported dependencies