Technical Docs

Search Documentation

Function: tribe

Returns a ready to use instance of the requested class.

Located at src/Tribe/Container.php (Line: 173)

Description

Example use:

 tribe_singleton( 'common.main', 'Tribe__Main');  // some code later...  tribe( 'common.main' )->do_something();

Parameters summary

(string|null) $slug_or_class Either the slug of a binding previously registered using <code>tribe_singleton</code> or <code>tribe_register</code> or the full class name that should be automagically created or <code>null</code> to get the container instance itself.

Return value summary

(mixed) The instance of the requested class. Please note that the cardinality of the class is controlled registering it as a singleton using <code>tribe_singleton</code> or <code>tribe_register</code>; if the <code>$slug_or_class</code> parameter is null then the container itself will be returned.
(object) The instance of the requested class. Please note that the cardinality of the class is controlled registering it as a singleton using <code>tribe_singleton</code> or <code>tribe_register</code>; if the <code>$slug_or_class</code> parameter is null then the container itself will be returned.
(Tribe__Container) The instance of the requested class. Please note that the cardinality of the class is controlled registering it as a singleton using <code>tribe_singleton</code> or <code>tribe_register</code>; if the <code>$slug_or_class</code> parameter is null then the container itself will be returned.

Examples

mixed|object|Tribe__Container tribe ( string|null $slug_or_class = null )