UrlGenerator.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace Illuminate\Contracts\Routing;
  3. interface UrlGenerator
  4. {
  5. /**
  6. * Get the current URL for the request.
  7. *
  8. * @return string
  9. */
  10. public function current();
  11. /**
  12. * Get the URL for the previous request.
  13. *
  14. * @param mixed $fallback
  15. * @return string
  16. */
  17. public function previous($fallback = false);
  18. /**
  19. * Generate an absolute URL to the given path.
  20. *
  21. * @param string $path
  22. * @param mixed $extra
  23. * @param bool|null $secure
  24. * @return string
  25. */
  26. public function to($path, $extra = [], $secure = null);
  27. /**
  28. * Generate a secure, absolute URL to the given path.
  29. *
  30. * @param string $path
  31. * @param array $parameters
  32. * @return string
  33. */
  34. public function secure($path, $parameters = []);
  35. /**
  36. * Generate the URL to an application asset.
  37. *
  38. * @param string $path
  39. * @param bool|null $secure
  40. * @return string
  41. */
  42. public function asset($path, $secure = null);
  43. /**
  44. * Get the URL to a named route.
  45. *
  46. * @param string $name
  47. * @param mixed $parameters
  48. * @param bool $absolute
  49. * @return string
  50. *
  51. * @throws \InvalidArgumentException
  52. */
  53. public function route($name, $parameters = [], $absolute = true);
  54. /**
  55. * Get the URL to a controller action.
  56. *
  57. * @param string|array $action
  58. * @param mixed $parameters
  59. * @param bool $absolute
  60. * @return string
  61. */
  62. public function action($action, $parameters = [], $absolute = true);
  63. /**
  64. * Set the root controller namespace.
  65. *
  66. * @param string $rootNamespace
  67. * @return $this
  68. */
  69. public function setRootControllerNamespace($rootNamespace);
  70. }