Skip to content

Conversation

@deligoez
Copy link
Member

Summary

This is a major version release (v6.0.0) that renames the main LaravelConfig class to ConfigManager and restructures the facade to follow Laravel conventions.

Problem

IDEs auto-import TarfinLabs\LaravelConfig\LaravelConfig (the class) instead of the facade when developers type LaravelConfig::. This causes "non-static method called statically" errors that are confusing and time-consuming to debug.

Solution

  • Rename LaravelConfig class to ConfigManager to prevent confusion
  • Move facade to Facades/LaravelConfig following Laravel's naming convention
  • The facade alias remains LaravelConfig, so existing code using the facade continues to work

Breaking Changes

Usage Affected? Notes
use LaravelConfig; (alias) No Works as before
read_config(), has_config() etc. No Works as before
app('laravel-config') No Works as before
new LaravelConfig() Yes Use new ConfigManager()
use TarfinLabs\LaravelConfig\LaravelConfig Yes Class no longer exists

Changes

Files Renamed/Moved

  • src/LaravelConfig.phpsrc/ConfigManager.php
  • src/LaravelConfigFacade.phpsrc/Facades/LaravelConfig.php

Updated Files

  • src/LaravelConfigServiceProvider.php - Uses ConfigManager
  • composer.json - Updated facade alias path, added PHP 8.5 support
  • tests/LaravelConfigTest.php - Updated to use ConfigManager
  • CHANGELOG.md - Added v6.0.0 entry with migration guide

New Tests

  • Container binding resolution test
  • Singleton behavior test
  • Helper function tests (read_config, has_config, create_config, set_config_value)

Migration Guide

If you were directly importing the LaravelConfig class:

// Before
use TarfinLabs\LaravelConfig\LaravelConfig;
$config = new LaravelConfig();

// After
use TarfinLabs\LaravelConfig\ConfigManager;
$config = new ConfigManager();

If you were using the facade or helper functions, no changes are required.

Test Plan

  • All 28 existing tests pass
  • New tests for container binding and helpers pass
  • Verified facade alias still works
  • Verified helper functions still work

deligoez and others added 17 commits December 22, 2025 18:10
BREAKING CHANGE: The main class has been renamed from LaravelConfig to ConfigManager
to prevent confusion with the facade.

This addresses the issue where IDEs would auto-import the class
(TarfinLabs\LaravelConfig\LaravelConfig) instead of the facade,
causing "non-static method called statically" errors.
- Move LaravelConfigFacade.php to src/Facades/LaravelConfig.php
- Update namespace to TarfinLabs\LaravelConfig\Facades
- Rename class from LaravelConfigFacade to LaravelConfig (no suffix)
- Add proper @method docblocks for IDE autocompletion
- Update @see to reference ConfigManager
Update the singleton binding to use the renamed ConfigManager class.
Update the LaravelConfig alias to point to the new facade location
at TarfinLabs\LaravelConfig\Facades\LaravelConfig.
- Update import statement to ConfigManager
- Update property type hint to ConfigManager
- Update instantiation to use ConfigManager
- Add test for container binding resolution to ConfigManager
- Add test for singleton behavior
- Add tests for helper functions: read_config, has_config, create_config, set_config_value
Document breaking changes:
- LaravelConfig class renamed to ConfigManager
- Facade moved to Facades directory
- Include migration guide for direct class importers
Allow tests to use the default database connection from phpunit.xml.dist
instead of hardcoding mysql.
- Add PHP 8.5 to test matrix
- Remove Laravel 8 from matrix (security vulnerabilities)
- Add proper exclusions for PHP/Laravel version compatibility:
  - PHP 8.1 doesn't support Laravel 11+ (requires PHP 8.2+)
  - PHP 8.5 only tests with Laravel 12
- Update composer.json to drop Laravel 8 support
- Update CHANGELOG with breaking changes
- Remove Laravel 8/9 from illuminate/support constraint
- Remove orchestra/testbench ^7.0 (Laravel 9 specific)
- Update GitHub Actions workflow matrix
- Add PHP 8.5 support to CI matrix
- Update CHANGELOG to reflect breaking changes
- Update phpunit.xml.dist to modern format (remove deprecated attributes)
- Convert test methods from @test annotation to test_ prefix convention
- Add .phpunit.cache to .gitignore
Switch to modern PHPUnit attribute-based test discovery for cleaner
test method names and better IDE support.
- Replace legacy factory with modern class-based ConfigFactory
- Add HasFactory trait to Config model
- Remove laravel/legacy-factories dependency
- Remove factory publishing (now auto-loaded from package)
- Update tests to use modern Config::factory() syntax
- Update CHANGELOG with migration guide
Resolved conflicts preferring v6 changes:
- tests.yml: Keep PHP 8.5 support and v6 exclude rules
- composer.json: Keep v6 require-dev versions
- phpunit.xml.dist: Keep cacheDirectory attribute
@deligoez deligoez merged commit 4cfd2bf into master Dec 25, 2025
22 checks passed
@deligoez deligoez deleted the WB-2115-laravel-config-v-6 branch December 25, 2025 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants