Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

How to access object properties in Grav?

Started by Alexander Kim 9 years ago · 1 replies · 1031 views
9 years ago

Here's the output of dump(Grav::instance()['uri']):

image|435x500

I've tried to get #paths[2] this way Grav::instance()['uri']->paths[2], but i'm getting this error: Cannot access protected property Grav\Common\Uri::$paths

9 years ago

It's protected by the class definition. You're not allowed to access it directly. What exactly are you trying to get out of the object? If you look at the URI API, you'll see there's a path() method that may get you what you're looking for.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 40 17 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago