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

Laravel 5.1 error #19

Closed
fscaptain opened this issue Dec 10, 2015 · 6 comments
Closed

Laravel 5.1 error #19

fscaptain opened this issue Dec 10, 2015 · 6 comments

Comments

@fscaptain
Copy link

Hi,

setting up as shown but get the follwoing error on laravel 5.1 :

Call to undefined method Nathanmac\Utilities\Parser\Facades\Parser::xml()

Thanks Marco

@nathanmac
Copy link
Owner

Hi @fscaptain, have you added the service provider and/or alias in the app/config/app.php file?

@fscaptain
Copy link
Author

Really, as described in the readme. Should it be that this may be wrong, because all others entries there are slighly different ?

@andreasba
Copy link

Did you try to escape the Classname like in

$xml = Parser::xml(($response->getBody()->getContents()));

?

I am running Parser on Laravel 5.1.26 without problems

Andreas

@fscaptain
Copy link
Author

Hi, in this way it works also for me, but if i try to use the alias it comes ot the error.

@sergchernata
Copy link

Having the same issue on Laravel 5.3

Calling this:

$parser = new Parser();
$parser->xml($xml);

results in:
Call to undefined method Nathanmac\Utilities\Parser\Facades\Parser::xml()

However, this works:

Parser::xml($xml);

@danhunsaker
Copy link
Contributor

@sergchernata - That appears to be working how Laravel Facades are meant to, yes - a Facade gives you a static interface to a common instance of an object, so you don't have to recreate it in, or pass it around to, every method you want to use it in.

If you want to use a regular object instead of a Facade, add use Nathanmac\Utilities\Parser\Parser; at the beginning of each file you want to use it in (instead of use Parser;, which will grab the Facade instead).

I agree the README is more than a little vague on this front. I'll see if I can clean it up some.

@fscaptain - I expect, since it's been about a year, that you aren't having this issue any more, likely because you're using something else to handle parsing, but if your troubles came from the same place, your solution should be the same, too. Either use the regular object directly along with new, or treat the Facade as a static interface to a singleton. Again, I'll see if I can submit a PR to update the README on this bit.

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

No branches or pull requests

5 participants