Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rawilk/laravel-settings
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.0
Choose a base ref
...
head repository: rawilk/laravel-settings
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Nov 14, 2023

  1. Update CHANGELOG

    rawilk authored and github-actions[bot] committed Nov 14, 2023
    Copy the full SHA
    0e7bcc2 View commit details

Commits on Dec 15, 2023

  1. Fix typo (#51)

    lakuapik authored Dec 15, 2023
    Copy the full SHA
    1ee8d5f View commit details
  2. PHP Linting (Pint)

    rawilk authored and github-actions[bot] committed Dec 15, 2023
    Copy the full SHA
    0f27c7c View commit details

Commits on Jan 1, 2024

  1. Bump aglipanci/laravel-pint-action from 2.3.0 to 2.3.1

    Bumps [aglipanci/laravel-pint-action](https://github.com/aglipanci/laravel-pint-action) from 2.3.0 to 2.3.1.
    - [Release notes](https://github.com/aglipanci/laravel-pint-action/releases)
    - [Commits](aglipanci/laravel-pint-action@2.3.0...2.3.1)
    
    ---
    updated-dependencies:
    - dependency-name: aglipanci/laravel-pint-action
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 1, 2024
    Copy the full SHA
    b75315d View commit details
  2. Merge pull request #52 from rawilk/dependabot/github_actions/aglipanc…

    …i/laravel-pint-action-2.3.1
    
    Bump aglipanci/laravel-pint-action from 2.3.0 to 2.3.1
    github-actions[bot] authored Jan 1, 2024
    Copy the full SHA
    ceef590 View commit details

Commits on Feb 28, 2024

  1. Copy the full SHA
    9f46c43 View commit details

Commits on Mar 4, 2024

  1. Bump ramsey/composer-install from 2 to 3

    Bumps [ramsey/composer-install](https://github.com/ramsey/composer-install) from 2 to 3.
    - [Release notes](https://github.com/ramsey/composer-install/releases)
    - [Commits](ramsey/composer-install@v2...v3)
    
    ---
    updated-dependencies:
    - dependency-name: ramsey/composer-install
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 4, 2024
    Copy the full SHA
    62e46d7 View commit details

Commits on Mar 10, 2024

  1. Merge pull request #58 from demianottema/main

    Added support for larvael 11.x
    rawilk authored Mar 10, 2024
    Copy the full SHA
    2c7b2e7 View commit details
  2. Merge pull request #59 from rawilk/dependabot/github_actions/ramsey/c…

    …omposer-install-3
    
    Bump ramsey/composer-install from 2 to 3
    rawilk authored Mar 10, 2024
    Copy the full SHA
    3531dfd View commit details
  3. Copy the full SHA
    635b47d View commit details
  4. Copy the full SHA
    cb7726d View commit details
  5. Merge pull request #60 from rawilk/laravel-11.x

    Finish Laravel 11.x Compatibility Update
    rawilk authored Mar 10, 2024
    Copy the full SHA
    9e46f29 View commit details
  6. Update CHANGELOG

    rawilk authored and github-actions[bot] committed Mar 10, 2024
    Copy the full SHA
    4e569cd View commit details
  7. Formatting

    rawilk committed Mar 10, 2024
    Copy the full SHA
    eb3912f View commit details
  8. PHP Linting (Pint)

    rawilk authored and github-actions[bot] committed Mar 10, 2024
    Copy the full SHA
    50ad4cf View commit details

Commits on Apr 15, 2024

  1. Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4

    Bumps [aglipanci/laravel-pint-action](https://github.com/aglipanci/laravel-pint-action) from 2.3.1 to 2.4.
    - [Release notes](https://github.com/aglipanci/laravel-pint-action/releases)
    - [Commits](aglipanci/laravel-pint-action@2.3.1...2.4)
    
    ---
    updated-dependencies:
    - dependency-name: aglipanci/laravel-pint-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 15, 2024
    Copy the full SHA
    cd0dfde View commit details
  2. Merge pull request #63 from rawilk/dependabot/github_actions/aglipanc…

    …i/laravel-pint-action-2.4
    
    Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4
    github-actions[bot] authored Apr 15, 2024
    Copy the full SHA
    3aa5d05 View commit details

Commits on Oct 16, 2024

  1. Formatting

    rawilk committed Oct 16, 2024
    Copy the full SHA
    9cfadff View commit details
  2. PHP Linting (Pint)

    rawilk authored and github-actions[bot] committed Oct 16, 2024
    Copy the full SHA
    0448307 View commit details
  3. Add new HashKeyGenerator

    rawilk committed Oct 16, 2024
    Copy the full SHA
    11dfc86 View commit details
  4. PHP Linting (Pint)

    rawilk authored and github-actions[bot] committed Oct 16, 2024
    Copy the full SHA
    974dd6d View commit details
  5. Test HashKeyGenerator

    rawilk committed Oct 16, 2024
    Copy the full SHA
    4169e05 View commit details
  6. Copy the full SHA
    f448d95 View commit details
  7. Merge pull request #68 from rawilk/hash-key-generator

    [Feature]: Hash key generator
    rawilk authored Oct 16, 2024
    Copy the full SHA
    2d93b02 View commit details
  8. Bump dependabot/fetch-metadata from 1.6.0 to 2.2.0

    Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.2.0.
    - [Release notes](https://github.com/dependabot/fetch-metadata/releases)
    - [Commits](dependabot/fetch-metadata@v1.6.0...v2.2.0)
    
    ---
    updated-dependencies:
    - dependency-name: dependabot/fetch-metadata
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 16, 2024
    Copy the full SHA
    4bf6505 View commit details
  9. Merge pull request #66 from rawilk/dependabot/github_actions/dependab…

    …ot/fetch-metadata-2.2.0
    
    Bump dependabot/fetch-metadata from 1.6.0 to 2.2.0
    rawilk authored Oct 16, 2024
    Copy the full SHA
    d4f370e View commit details
  10. Fix tests

    rawilk committed Oct 16, 2024
    Copy the full SHA
    dc0e9e5 View commit details
  11. wip

    rawilk committed Oct 16, 2024
    Copy the full SHA
    70ed7a5 View commit details
  12. Update docs

    rawilk committed Oct 16, 2024
    Copy the full SHA
    8ac3cb1 View commit details
  13. Update CHANGELOG

    rawilk authored and github-actions[bot] committed Oct 16, 2024
    Copy the full SHA
    7f5cf13 View commit details

Commits on Jan 27, 2025

  1. Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0

    Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.2.0 to 2.3.0.
    - [Release notes](https://github.com/dependabot/fetch-metadata/releases)
    - [Commits](dependabot/fetch-metadata@v2.2.0...v2.3.0)
    
    ---
    updated-dependencies:
    - dependency-name: dependabot/fetch-metadata
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 27, 2025
    Copy the full SHA
    4b11393 View commit details
  2. Merge pull request #75 from rawilk/dependabot/github_actions/dependab…

    …ot/fetch-metadata-2.3.0
    
    Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0
    github-actions[bot] authored Jan 27, 2025
    Copy the full SHA
    444dcd2 View commit details

Commits on Feb 3, 2025

  1. Bump aglipanci/laravel-pint-action from 2.4 to 2.5

    Bumps [aglipanci/laravel-pint-action](https://github.com/aglipanci/laravel-pint-action) from 2.4 to 2.5.
    - [Release notes](https://github.com/aglipanci/laravel-pint-action/releases)
    - [Commits](aglipanci/laravel-pint-action@2.4...2.5)
    
    ---
    updated-dependencies:
    - dependency-name: aglipanci/laravel-pint-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 3, 2025
    Copy the full SHA
    8bf4e1e View commit details
  2. Merge pull request #77 from rawilk/dependabot/github_actions/aglipanc…

    …i/laravel-pint-action-2.5
    
    Bump aglipanci/laravel-pint-action from 2.4 to 2.5
    github-actions[bot] authored Feb 3, 2025
    Copy the full SHA
    6840b1a View commit details

Commits on Feb 25, 2025

  1. Remove larastan (#78)

    rawilk authored Feb 25, 2025
    Copy the full SHA
    ee2556e View commit details
  2. Add Laravel 12.x support

    rawilk committed Feb 25, 2025
    Copy the full SHA
    c367385 View commit details
  3. Copy the full SHA
    f158feb View commit details
  4. Copy the full SHA
    c02026e View commit details
  5. Copy the full SHA
    94738ac View commit details
  6. Update CHANGELOG

    rawilk authored and github-actions[bot] committed Feb 25, 2025
    Copy the full SHA
    b10486e View commit details
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v2.3.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

26 changes: 0 additions & 26 deletions .github/workflows/larastan.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
ref: ${{ github.head_ref }}

- name: Laravel pint
uses: aglipanci/laravel-pint-action@2.3.0
uses: aglipanci/laravel-pint-action@2.5
with:
preset: laravel

16 changes: 14 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -7,19 +7,31 @@ on:
- 'phpunit.xml.dist'
- '.github/workflows/run-tests.yml'
- 'composer.json'
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.3, 8.2, 8.1]
laravel: [10.*]
php: [8.4, 8.3, 8.2, 8.1]
laravel: [12.*, 11.*, 10.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 12.*
testbench: 10.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 12.*
php: 8.1
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,54 @@

All notable changes to `laravel-settings` will be documented in this file

## v3.4.1 - 2025-02-25

### What's Changed

* Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in https://github.com/rawilk/laravel-settings/pull/75
* Bump aglipanci/laravel-pint-action from 2.4 to 2.5 by @dependabot in https://github.com/rawilk/laravel-settings/pull/77
* [Chore]: Remove Larastan by @rawilk in https://github.com/rawilk/laravel-settings/pull/78
* Add Laravel 12.x support by @rawilk in https://github.com/rawilk/laravel-settings/pull/79
* Add php 8.4 support by @rawilk in https://github.com/rawilk/laravel-settings/pull/80

**Full Changelog**: https://github.com/rawilk/laravel-settings/compare/v3.4.0...v3.4.1

## v3.4.0 - 2024-10-16

### What's Changed

* Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in https://github.com/rawilk/laravel-settings/pull/63
* [Feature]: Hash key generator by @rawilk in https://github.com/rawilk/laravel-settings/pull/68
* Bump dependabot/fetch-metadata from 1.6.0 to 2.2.0 by @dependabot in https://github.com/rawilk/laravel-settings/pull/66

**Full Changelog**: https://github.com/rawilk/laravel-settings/compare/v3.3.1...v3.4.0

## v3.3.1 - 2024-03-10

### What's Changed

* Fix typo by @lakuapik in https://github.com/rawilk/laravel-settings/pull/51
* Bump aglipanci/laravel-pint-action from 2.3.0 to 2.3.1 by @dependabot in https://github.com/rawilk/laravel-settings/pull/52
* Added support for larvael 11.x by @demianottema in https://github.com/rawilk/laravel-settings/pull/58
* Bump ramsey/composer-install from 2 to 3 by @dependabot in https://github.com/rawilk/laravel-settings/pull/59
* Finish Laravel 11.x Compatibility Update by @rawilk in https://github.com/rawilk/laravel-settings/pull/60

### New Contributors

* @lakuapik made their first contribution in https://github.com/rawilk/laravel-settings/pull/51
* @demianottema made their first contribution in https://github.com/rawilk/laravel-settings/pull/58

**Full Changelog**: https://github.com/rawilk/laravel-settings/compare/v3.3.0...v3.3.1

## v3.3.0 - 2023-11-14

### What's Changed

- Add safelist for object unserialization by @rawilk in https://github.com/rawilk/laravel-settings/pull/47
- Update docs by @rawilk in https://github.com/rawilk/laravel-settings/pull/48

**Full Changelog**: https://github.com/rawilk/laravel-settings/compare/v3.2.0...v3.3.0

## v3.2.0 - 2023-11-01

### What's Changed
14 changes: 6 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -19,17 +19,16 @@
}
],
"require": {
"php": "^8.1|^8.2|^8.3",
"illuminate/database": "^10.0",
"illuminate/support": "^10.0",
"php": "^8.1",
"illuminate/database": "^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"spatie/laravel-package-tools": "^1.13"
},
"require-dev": {
"laravel/pint": "^1.2",
"nunomaduro/larastan": "^2.6",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.10",
"pestphp/pest-plugin-laravel": "^2.2",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"pestphp/pest": "^2.10|^3.0",
"pestphp/pest-plugin-laravel": "^2.2|^3.0",
"spatie/laravel-ray": "^1.31"
},
"autoload": {
@@ -49,7 +48,6 @@
"post-autoload-dump": [
"@php ./vendor/bin/testbench package:discover --ansi"
],
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest -p",
"format": "vendor/bin/pint --dirty"
},
11 changes: 11 additions & 0 deletions config/settings.php
Original file line number Diff line number Diff line change
@@ -145,6 +145,7 @@
| Supported:
| - \Rawilk\Settings\Support\KeyGenerators\ReadableKeyGenerator
| - \Rawilk\Settings\Support\KeyGenerators\Md5KeyGenerator (default)
| - \Rawilk\Settings\Support\KeyGenerators\HashKeyGenerator
|
*/
'key_generator' => \Rawilk\Settings\Support\KeyGenerators\Md5KeyGenerator::class,
@@ -194,4 +195,14 @@
\Carbon\CarbonImmutable::class,
\Illuminate\Support\Carbon::class,
],

/*
|--------------------------------------------------------------------------
| Hash Algorithm
|--------------------------------------------------------------------------
|
| The hashing algorithm to use for the HashKeyGenerator.
|
*/
'hash_algorithm' => 'xxh128',
];
40 changes: 40 additions & 0 deletions docs/api/settings.md
Original file line number Diff line number Diff line change
@@ -53,6 +53,8 @@ public function get(string|BackedEnum $key, $default = null)
public function all($keys = null): \Illuminate\Support\Collection
```

> {note} The `DotNotationContextSerializer` context serializer must be used for this to work properly.
### has

```php
@@ -119,6 +121,44 @@ public function isTrue(string|BackedEnum $key, $default = true): bool
public function flush($keys = null): void
```

### getTeamId

```php
/**
* Retrieve the current team id for settings.
*/
public function getTeamId(): mixed;
```

### setTeamId

```php
/**
* Set the current team id for teams/groups support.
*
* @param Model|int|null|string $id
*/
public function setTeamId(mixed $id): Settings;
```

### usingTeam

```php
/**
* Use a team for a single call.
*/
public function usingTeam(mixed $teamId): Settings;
```

### withoutTeams

```php
/**
* Perform a single settings call without a team context.
*/
public function withoutTeams(): Settings;
```

### cacheKeyForSetting

```php
2 changes: 1 addition & 1 deletion docs/basic-usage/teams.md
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ Settings::context($userContext)->get('timezone'); // UTC

Settings::setTeamId(2);

Settings::contest($userContext)->get('timezone'); // America/Chicago
Settings::context($userContext)->get('timezone'); // America/Chicago
```

This will also work with [model settings](/docs/laravel-settings/{version}/basic-usage/model-settings) as well. For more information on the
13 changes: 0 additions & 13 deletions phpstan.neon.dist

This file was deleted.

2 changes: 1 addition & 1 deletion src/Contracts/ContextSerializer.php
Original file line number Diff line number Diff line change
@@ -8,5 +8,5 @@

interface ContextSerializer
{
public function serialize(Context $context = null): string;
public function serialize(?Context $context = null): string;
}
2 changes: 1 addition & 1 deletion src/Contracts/KeyGenerator.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

interface KeyGenerator
{
public function generate(string $key, Context $context = null): string;
public function generate(string $key, ?Context $context = null): string;

public function removeContextFromKey(string $key): string;

3 changes: 1 addition & 2 deletions src/Drivers/DatabaseDriver.php
Original file line number Diff line number Diff line change
@@ -17,8 +17,7 @@ public function __construct(
protected Connection $connection,
protected string $table,
protected ?string $teamForeignKey = null,
) {
}
) {}

public function forget($key, $teamId = null): void
{
4 changes: 1 addition & 3 deletions src/Drivers/EloquentDriver.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,7 @@

class EloquentDriver implements Driver
{
public function __construct(protected Setting $model)
{
}
public function __construct(protected Setting $model) {}

public function forget($key, $teamId = null): void
{
8 changes: 3 additions & 5 deletions src/Drivers/Factory.php
Original file line number Diff line number Diff line change
@@ -17,11 +17,9 @@ class Factory

protected array $customCreators = [];

public function __construct(protected Application $app)
{
}
public function __construct(protected Application $app) {}

public function driver(string $driver = null): Driver
public function driver(?string $driver = null): Driver
{
return $this->resolveDriver($driver);
}
@@ -64,7 +62,7 @@ protected function getDriverConfig(string $driver): ?array
return $this->app['config']["settings.drivers.{$driver}"];
}

protected function resolveDriver(string $driver = null): Driver
protected function resolveDriver(?string $driver = null): Driver
{
$driver = $driver ?: $this->getDefaultDriver();

3 changes: 1 addition & 2 deletions src/Events/SettingWasDeleted.php
Original file line number Diff line number Diff line change
@@ -19,6 +19,5 @@ public function __construct(
public string $cacheKey,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/SettingWasStored.php
Original file line number Diff line number Diff line change
@@ -20,6 +20,5 @@ public function __construct(
public mixed $value,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/SettingsFlushed.php
Original file line number Diff line number Diff line change
@@ -18,6 +18,5 @@ public function __construct(
public bool|Collection|string $keys,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
8 changes: 4 additions & 4 deletions src/Settings.php
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
use Rawilk\Settings\Exceptions\InvalidEnumType;
use Rawilk\Settings\Exceptions\InvalidKeyGenerator;
use Rawilk\Settings\Support\Context;
use Rawilk\Settings\Support\KeyGenerators\HashKeyGenerator;
use Rawilk\Settings\Support\KeyGenerators\Md5KeyGenerator;

class Settings
@@ -66,8 +67,7 @@ public function __construct(
protected Driver $driver,
protected KeyGenerator $keyGenerator,
protected ValueSerializer $valueSerializer,
) {
}
) {}

// mainly for testing purposes
public function getDriver(): Driver
@@ -79,7 +79,7 @@ public function getDriver(): Driver
* Pass in `false` for context when calling `all()` to only return results
* that do not have context.
*/
public function context(Context|bool $context = null): self
public function context(Context|bool|null $context = null): self
{
$this->context = $context;

@@ -596,7 +596,7 @@ protected function normalizeBulkLookupKey($key): string|Collection|bool
{
if (is_null($key) && $this->context !== null) {
throw_if(
$this->keyGenerator instanceof Md5KeyGenerator,
$this->keyGenerator instanceof Md5KeyGenerator || $this->keyGenerator instanceof HashKeyGenerator,
InvalidKeyGenerator::forPartialLookup($this->keyGenerator::class),
);

2 changes: 1 addition & 1 deletion src/Support/ContextSerializers/ContextSerializer.php
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

class ContextSerializer implements ContextSerializerContract
{
public function serialize(Context $context = null): string
public function serialize(?Context $context = null): string
{
return serialize($context);
}
Loading