Skip to content

Conversation

@Greg0
Copy link
Contributor

@Greg0 Greg0 commented Aug 16, 2025

Summary

Replace the custom logger implementation with PSR-3 compliant logging interfaces, bringing the PHP SDK in line with established PHP logging standards and improving interoperability with existing logging solutions.

What Changed

Core Changes

  • PSR-3 Compliance: Logger now implements Psr\Log\LoggerInterface and uses LoggerTrait
  • Standard Log Levels: Migrated from custom log levels (warn, error, etc.) to PSR-3 standard levels (LogLevel::WARNING, LogLevel::ERROR, etc.)
  • Improved Error Context: Enhanced error logging with proper exception context and structured data

Dependencies

  • Added psr/log ^2.0: Core PSR-3 logging interface dependency
  • Backward Compatible: Uses PSR-3 v2.0 for broader PHP version compatibility

API Updates

  • Method Names: Updated warn() calls to warning() throughout codebase
  • Type Hints: Added proper LoggerInterface type hints across all classes
  • Context Structure: Improved logging context with consistent exception handling

Documentation

  • Updated README: Refreshed logging section to reference PSR-3 standard

No breaking changes for basic usage. The SDK maintains its existing logging behavior by default, but now accepts any PSR-3 compliant logger:

This change positions the Featurevisor PHP SDK as a more mature, standards-compliant library that integrates seamlessly with the broader PHP ecosystem.

@fahad19
Copy link
Member

fahad19 commented Aug 16, 2025

amazing! all tests are passing! 🚀

I will take a look tomorrow (Sunday) one more time aim for merge and release. thanks a lot!

@Greg0
Copy link
Contributor Author

Greg0 commented Aug 17, 2025

Please hold on with merging that PR. I would like to add one more thing:

  • get rid of echoes in default logger handler. In PHP it's not good practice to echo things, it can corrupt application output that uses library. I assume that intention was to put logs into terminal. If so STDOUT is the right way.

@Greg0
Copy link
Contributor Author

Greg0 commented Aug 17, 2025

@fahad19 I've made changes I mentioned above. Few test cases were deleted due to untestable STDOUT stream. Working of that solution is delivered by language itself.

@fahad19
Copy link
Member

fahad19 commented Aug 17, 2025

will wait for your green light here before going for the merge.

@Greg0
Copy link
Contributor Author

Greg0 commented Aug 17, 2025

Rebased. IMO can be merged

@fahad19 fahad19 merged commit 9310c48 into featurevisor:main Aug 17, 2025
1 check passed
@fahad19
Copy link
Member

fahad19 commented Aug 17, 2025

landed in v0.3.0: https://github.com/featurevisor/featurevisor-php/releases/tag/v0.3.0

thanks a lot, @Greg0!

once you feel it's time, would be great to also update the example PHP app here to new users can see real world example of latest SDK being used in an app: https://github.com/featurevisor/featurevisor-example-php

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.

2 participants