GreenLight has various helper functions that either extend general Laravel helpers or provide functionality that several previous projects needed and it was reasonable to keep them in the package as well.
These helper functions can be found in the \Greenroom\GreenLight\Helper
class. As of GreenLight 2.x, these functions
are also accessible via:
GreenLight::getImage(...)
)Visibility | Function |
---|---|
public static | addTruncateMarkup(mixed $text, int $length=150) : string Adds a truncated markup element after the desired character count in a string. |
public static | getDayName(\Carbon\Carbon $date) : string Returns the name of the day of a Carbon date |
public static | getFormattedDate(\Carbon\Carbon $date) : string Returns the formatted string of a Carbon date based on actual locale |
public static | getImage(null $image_src=null, null $prefix=null) : string Helper function alias for \Greenroom\GreenLight\ImageHandler::getImage |
public static | getModelNameWithNamespace(mixed $modelName) : string Returns a fully qualified GreenLight model class name. Checking whether the model is available in the app namespace and returning the path based on that |
public static | getModuleText(mixed $alias, array $params=array()) : string Returns a GeneralText instance by alias, replaces data using replaceText() based on the passed parameters. |
public static | getMonthName(\Carbon\Carbon $date) : string Returns the name of the month of a Carbon date |
public static | getShortMonthName(\Carbon\Carbon $date) : string Returns the short name of the month of a Carbon date |
public static | htmlToMetaData(mixed $text) : string Removes html tags and decodes html entities to support meta tags |
public static | matchUrlProtocolToHost(mixed $url) : string Converts a given https / http url's protocol to match the request's one |
public static | nbspLastWord(mixed $string, int $length=5) : mixed Replaces last space character of a given string to a if the last word found is shorter than the specified length |
public static | relativeAction(mixed $name, array $parameters=array()) : string Working similar to the original action() helper function, it returns a relative path based on the action name |
public static | replaceText(mixed $text, array/mixed $params=array()) : string Replaces data based on passed parameters |
public static | youTubeURLToEmbed(mixed $url) : bool/string Converts a given YouTube url to its embed version |