Skip to content

Allow passing reader class and arguments as array #164

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

Merged
merged 2 commits into from
Oct 17, 2019

Conversation

tooblue
Copy link
Contributor

@tooblue tooblue commented Oct 16, 2019

Laravel does not support closures within the config files (laravel/framework#9625), and so setting the geocoder.reader configuration to an instance of \GeoIp2\Database\Reader or \GeoIp2\WebService\Client created problems when running php artisan config:cache.

With the changes I made, you could configure the reader like so:

    'reader' => [
        'class' => WebService::class,
        'arguments' => [env('MAXMIND_USER_ID'), env('MAXMIND_LICENSE_KEY')],
    ],

It also still supports the old method of setting the reader instance:

    'reader' => new WebService(
        env('MAXMIND_USER_ID'),
        env('MAXMIND_LICENSE_KEY')
    ),

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 89.764% when pulling dde4def on tooblue:patch-1 into 67f027b on geocoder-php:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 89.764% when pulling dde4def on tooblue:patch-1 into 67f027b on geocoder-php:master.

@mikebronner
Copy link
Member

@tooblue Good PR! Thanks :) I'll take a look at this over the next day or so. :)

@mikebronner mikebronner merged commit f576885 into geocoder-php:master Oct 17, 2019
@mikebronner
Copy link
Member

@tooblue Could you give release 4.2.4 a try and let me know if it works for you?

@tooblue
Copy link
Contributor Author

tooblue commented Oct 17, 2019

@mikebronner That works! Thanks very much. :)

@tooblue tooblue deleted the patch-1 branch October 17, 2019 14:53
@mikebronner
Copy link
Member

Awesome! :) I changed the syntax around a bit to better match the other array-notations. Thanks for your work on this! :)

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