Framework: Foundation package depends on an "Auth" package

Created on 11 May 2017  路  8Comments  路  Source: laravel/framework

  • Laravel Version: 5.5@dev
  • PHP Version: 7
  • Database Driver & Version: N/A

Description:

Foundation package appears to depend on having an Auth package.

This is more a line of inquiry than anything else, should there be an if (class_exists('Auth')) expression in here to decouple them?

Reference code:
https://github.com/laravel/framework/blob/841b36cc005ee5c400f1276175db9e2692d1e167/src/Illuminate/Foundation/Exceptions/Handler.php#L130-L133

All 8 comments

This is not a bug. Open an issue in the laravel/internals repo or use the forums / slack channel to solve your issue

This is not a bug.

@Dylan-DPC, replication instructions:

  1. Remove the Auth provider
  2. Throw an exception
  3. Class "auth" is not registered

should there be an if (class_exists('Auth')) expression in here to decouple them?

If you're loading laravel/framework, Auth class does exist. You should check if App::bound('auth') etc.

@themsaid? Should this be a pull request?

I don't see a scenario where you need to load Foundation without the framework, and if you have the framework then Auth is there already.

This is to use the framework without loading Auth, currently not possible as it is coupled to the Foundation exception handler.

I don't think it's possible to use the whole Framework except for a specific component, I understand though using different components together.

This is a bug, or at least a poorly thought through feature. It was only added last month by Taylor: https://github.com/laravel/framework/commit/23b7d6b45c675bcd93e9f1fb9cd33e71779142c6.

This is meant to add context to logs for easier searching through them; which is all well and good, but not the way it's currently implemented. I suggest that it would be better to fire an event here or something similar to allow applications to define their own context information that they would like to add to the logs instead of just assuming that the information provided by the Auth package is useful. Several applications may not use the Auth package at all, and other applications may have other information that is more useful to provide as context in the logs than the theoretical user ID and email.

Was this page helpful?
0 / 5 - 0 ratings