UrlGenerator.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. namespace Illuminate\Contracts\Routing;
  3. /**
  4. * @method string query(string $path, array $query = [], mixed $extra = [], bool|null $secure = null)
  5. */
  6. interface UrlGenerator
  7. {
  8. /**
  9. * Get the current URL for the request.
  10. *
  11. * @return string
  12. */
  13. public function current();
  14. /**
  15. * Get the URL for the previous request.
  16. *
  17. * @param mixed $fallback
  18. * @return string
  19. */
  20. public function previous($fallback = false);
  21. /**
  22. * Generate an absolute URL to the given path.
  23. *
  24. * @param string $path
  25. * @param mixed $extra
  26. * @param bool|null $secure
  27. * @return string
  28. */
  29. public function to($path, $extra = [], $secure = null);
  30. /**
  31. * Generate a secure, absolute URL to the given path.
  32. *
  33. * @param string $path
  34. * @param array $parameters
  35. * @return string
  36. */
  37. public function secure($path, $parameters = []);
  38. /**
  39. * Generate the URL to an application asset.
  40. *
  41. * @param string $path
  42. * @param bool|null $secure
  43. * @return string
  44. */
  45. public function asset($path, $secure = null);
  46. /**
  47. * Get the URL to a named route.
  48. *
  49. * @param string $name
  50. * @param mixed $parameters
  51. * @param bool $absolute
  52. * @return string
  53. *
  54. * @throws \InvalidArgumentException
  55. */
  56. public function route($name, $parameters = [], $absolute = true);
  57. /**
  58. * Create a signed route URL for a named route.
  59. *
  60. * @param string $name
  61. * @param mixed $parameters
  62. * @param \DateTimeInterface|\DateInterval|int|null $expiration
  63. * @param bool $absolute
  64. * @return string
  65. *
  66. * @throws \InvalidArgumentException
  67. */
  68. public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true);
  69. /**
  70. * Create a temporary signed route URL for a named route.
  71. *
  72. * @param string $name
  73. * @param \DateTimeInterface|\DateInterval|int $expiration
  74. * @param array $parameters
  75. * @param bool $absolute
  76. * @return string
  77. */
  78. public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true);
  79. /**
  80. * Get the URL to a controller action.
  81. *
  82. * @param string|array $action
  83. * @param mixed $parameters
  84. * @param bool $absolute
  85. * @return string
  86. */
  87. public function action($action, $parameters = [], $absolute = true);
  88. /**
  89. * Get the root controller namespace.
  90. *
  91. * @return string
  92. */
  93. public function getRootControllerNamespace();
  94. /**
  95. * Set the root controller namespace.
  96. *
  97. * @param string $rootNamespace
  98. * @return $this
  99. */
  100. public function setRootControllerNamespace($rootNamespace);
  101. }