Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PSR 3 #67

Open
arhimede opened this issue Jan 31, 2025 · 5 comments
Open

Implement PSR 3 #67

arhimede opened this issue Jan 31, 2025 · 5 comments
Assignees
Milestone

Comments

@arhimede
Copy link
Member

Feature Request

add back in composer the require for PSR 3
https://github.com/php-fig/log

Summary

@alexmerlin
Copy link
Member

Long story short: laminas-log is not PSR-3 compliant!


As described in the specifications, chapter 1.1:

The LoggerInterface exposes eight methods to write logs to the eight RFC 5424 levels (debug, info, notice, warning, error, critical, alert, emergency).

In order to be PSR-3 compliant, laminas-log should have implemented Psr\Log\LoggerInterface and exposed the above mentioned eight methods.

Instead, they implemented Laminas\Log\LoggerInterface and exposed their own version of the eight methods, with different naming (emerg() vs emergency() etc.).

Basically, they only implemented Psr\Log\LoggerInterface internally and added a wrapper on top of it, which exposed their own "standard".

@arhimede In order to make dot-log PSR-3 compliant, we must introduce a new BC, which means:

  • deprecating the current incorrectly named methods in the current version
  • introducing the new standard methods in a new major version

@arhimede
Copy link
Member Author

Why we are not focusing on laminas-log and make it psr3 compliant instead ?

@alexmerlin
Copy link
Member

Why we are not focusing on laminas-log and make it psr3 compliant instead ?

Because:

  • it is archived
  • in this issue, instead of reviving it, we decided to go with our own, lighter dot-log, which does not depend on laminas-log
  • making laminas-log PSR-3 compliant would require a new, totally backwards incompatible, major version release

@arhimede
Copy link
Member Author

Why we are not focusing on laminas-log and make it psr3 compliant instead ?

Because:

* it is archived

* in [this issue](https://github.com/dotkernel/dot-log/issues/49), instead of reviving it, we decided to go with our own, lighter `dot-log`, which does not depend on `laminas-log`

* making `laminas-log` PSR-3 compliant would require a new, totally backwards incompatible, major version release

So in this case seem to be a good idea to make dot-log psr3 compliant, and make it a new major version
We need to try to enforce the standards ...

@arhimede arhimede added this to the 5.0 milestone Feb 3, 2025
@arhimede arhimede pinned this issue Feb 3, 2025
@alexmerlin
Copy link
Member

alexmerlin commented Feb 3, 2025

We decided against monolog due to the vast size of requirements.


Installing the package using composer install --ignore-platform-reqs downloads the following:

aws/aws-crt-php                    v1.2.7             AWS Common Runtime for PHP
aws/aws-sdk-php                    3.339.4            AWS SDK for PHP - Use Amazon Web Services in your PHP project
doctrine/couchdb                   dev-master 9eeb9e5 CouchDB Client
doctrine/lexer                     3.0.1              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
egulias/email-validator            4.0.3              A library for validating emails against several RFCs
elastic/transport                  v8.10.0            HTTP transport PHP library for Elastic products
elasticsearch/elasticsearch        v8.17.0            PHP Client for Elasticsearch
graylog2/gelf-php                  2.0.2              A php implementation to send log-messages to a GELF compatible backend like Graylog2.
guzzlehttp/guzzle                  7.9.2              Guzzle is a PHP HTTP client library
guzzlehttp/promises                2.0.4              Guzzle promises library
guzzlehttp/psr7                    2.7.0              PSR-7 message implementation that also provides common utility methods
mongodb/mongodb                    1.20.0             MongoDB driver library
mtdowling/jmespath.php             2.8.0              Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy                  1.12.1             Create deep copies (clones) of your objects
nikic/php-parser                   v5.4.0             A PHP parser written in PHP
open-telemetry/api                 1.2.1              API for OpenTelemetry PHP.
open-telemetry/context             1.1.0              Context implementation for OpenTelemetry PHP.
paragonie/constant_time_encoding   v3.0.0             Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
paragonie/random_compat            v9.99.100          PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                   2.0.4              Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1              Library for handling version information and constraints
php-amqplib/php-amqplib            v3.7.2             Formerly videlalvaro/php-amqplib.  This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.
php-console/php-console            3.1.8              PHP library for Google Chrome extension "PHP Console".
php-http/discovery                 1.20.0             Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
php-http/httplug                   2.4.1              HTTPlug, the HTTP client abstraction for PHP
php-http/promise                   1.3.1              Promise used for asynchronous HTTP requests
phpseclib/phpseclib                3.0.43             PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
phpstan/phpstan                    2.1.2              PHPStan - PHP Static Analysis Tool
phpstan/phpstan-deprecation-rules  2.0.1              PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
phpstan/phpstan-strict-rules       2.0.3              Extra strict and opinionated rules for PHPStan
phpunit/php-code-coverage          11.0.8             Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          5.1.0              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                5.0.1              Invoke callables with a timeout
phpunit/php-text-template          4.0.1              Simple template engine.
phpunit/php-timer                  7.0.1              Utility class for timing
phpunit/phpunit                    11.5.6             The PHP Unit Testing framework.
predis/predis                      v2.3.0             A flexible and feature-complete Redis client for PHP.
psr/container                      2.0.2              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0              Standard interfaces for event handling.
psr/http-client                    1.0.3              Common interface for HTTP clients
psr/http-factory                   1.1.0              PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message                   2.0                Common interface for HTTP messages
psr/log                            3.0.2              Common interface for logging libraries
ralouphie/getallheaders            3.0.3              A polyfill for getallheaders.
rollbar/rollbar                    v4.0.2             Monitors errors and exceptions and reports them to Rollbar
ruflin/elastica                    8.1.0              Elasticsearch Client
sebastian/cli-parser               3.0.2              Library for parsing CLI options
sebastian/code-unit                3.0.2              Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 4.0.1              Looks up which function or method a line of code belongs to
sebastian/comparator               6.3.0              Provides the functionality to compare PHP values for equality
sebastian/complexity               4.0.1              Library for calculating the complexity of PHP code units
sebastian/diff                     6.0.2              Diff implementation
sebastian/environment              7.2.0              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 6.3.0              Provides the functionality to export PHP variables for visualization
sebastian/global-state             7.0.2              Snapshotting of global state
sebastian/lines-of-code            3.0.1              Library for counting the lines of code in PHP source code
sebastian/object-enumerator        6.0.1              Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         4.0.1              Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        6.0.2              Provides functionality to recursively process PHP variables
sebastian/type                     5.1.0              Collection of value objects that represent the types of the PHP type system
sebastian/version                  5.0.2              Library that helps with managing the version number of Git-hosted PHP projects
staabm/side-effects-detector       1.0.5              A static analysis tool to detect side effects in PHP code
symfony/deprecation-contracts      v3.5.1             A generic function and convention to trigger deprecation notices
symfony/event-dispatcher           v7.2.0             Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.5.1             Generic abstractions related to dispatching event
symfony/mailer                     v6.4.18            Helps sending emails
symfony/mime                       v6.4.18            Allows manipulating MIME messages
symfony/polyfill-intl-idn          v1.31.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.31.0            Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.31.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php80             v1.31.0            Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.31.0            Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/polyfill-php82             v1.31.0            Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions
symfony/service-contracts          v3.5.1             Generic abstractions related to writing services
theseer/tokenizer                  1.2.3              A small library for converting tokenized PHP source code into XML and potentially other formats

Note:

--ignore-platform-reqs was needed only to bypass a missing PHP extension.


Installing the package with composer install --no-dev --ignore-platform-reqs installs only:

psr/log 3.0.2 Common interface for logging libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants