You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since one can use illuminate/collections outside of Laravel it would be cool, if your macros would support also non Laravel projects.
As I reviewed the source, there must only be a few changes made. Eg. making the private method in CollectionMacroServiceProvider a public static one, create a autoload file with some logic to determine, if one is in a Laravel app and duplicate the part inside the register method.
For the logic, I'm not sure if something like if (!function_exists('app')) will suffice. Maybe you have an idea for a more elegant solution?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Since one can use
illuminate/collections
outside of Laravel it would be cool, if your macros would support also non Laravel projects.As I reviewed the source, there must only be a few changes made. Eg. making the private method in
CollectionMacroServiceProvider
a public static one, create a autoload file with some logic to determine, if one is in a Laravel app and duplicate the part inside the register method.For the logic, I'm not sure if something like
if (!function_exists('app'))
will suffice. Maybe you have an idea for a more elegant solution?I would be happy to create a PR, if you like.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions