Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Laravel Framework
https://github.com/laravel/framework
Admin
The Laravel Framework.
Tokens:
804,860
Snippets:
6,320
Trust Score:
9.7
License:
MIT
Update:
1 week ago
Context
Chat
Benchmark
59.35
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### start Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Ensures a string starts with a given prefix. This is useful for normalizing path prefixes or other leading characters. ```APIDOC ## start ### Description Ensures a string starts with a given prefix. This is useful for normalizing path prefixes or other leading characters. ### Method `public static function start($value, $prefix)` ### Parameters - **$value** (string) - Required - The string to modify. - **$prefix** (string) - Required - The prefix to ensure at the beginning. ### Return Value - **string** - The string with the prefix ensured. ``` -------------------------------- ### when Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/container.md Starts a contextual binding definition. Returns a ContextualBindingBuilder that allows specifying needs and give. ```APIDOC ## when ### Description Starts a contextual binding definition. Returns a ContextualBindingBuilder that allows specifying needs and give. ### Method Instance ### Signature `when($concrete): ContextualBindingBuilder` ### Parameters - `$concrete` (string) - Required - The concrete class for which the binding is contextual. ### Returns - `ContextualBindingBuilder` - A builder instance. ### Example ```php $container->when('App\Controller') ->needs('App\Contracts\Service') ->give('App\Services\SpecificService'); ``` ``` -------------------------------- ### Example: package provider Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/service-provider.md Shows a typical package service provider that registers singletons, merges config, loads routes, views, and migrations, and publishes a config file. The `publishes` call uses the 'analytics-config' group. This example is intended for package developers. ```php namespace App\Providers; use Illuminate\Support\ServiceProvider; class PackageServiceProvider extends ServiceProvider { public array $singletons = [ \App\Services\Analytics::class => \App\Services\Analytics::class, ]; public function register(): void { $this->mergeConfigFrom(__DIR__.'/../../config/analytics.php', 'analytics'); } public function boot(): void { $this->loadRoutesFrom(__DIR__.'/../../routes/web.php'); $this->loadViewsFrom(__DIR__.'/../../resources/views', 'analytics'); $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); $this->publishes([ __DIR__.'/../../config/analytics.php' => config_path('analytics.php'), ], 'analytics-config'); } } ``` -------------------------------- ### Signature-based command example with argument and option handling Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/console-command.md Complete example of a command using a fluent signature with a required argument and an option. Shows how to retrieve argument and option values, iterate over them, and return a success code. ```php namespace App\Console\Commands; use Illuminate\Console\Command; class SendEmails extends Command { protected $signature = 'mail:send {user* : User IDs} {--Q|queue : Queue the job}'; protected $description = 'Send marketing emails'; public function handle(): int { $userIds = $this->argument('user'); $queue = $this->option('queue'); foreach ($userIds as $id) { // … } $this->info('Done'); $this->newLine(); return self::SUCCESS; } } ``` -------------------------------- ### commandStartedAt() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Returns the time the current command started, or null if not started. ```APIDOC ## commandStartedAt() ### Description Returns the time the current command started, or null if not started. ### Method commandStartedAt ### Parameters None ### Return Value - **Carbon|null** - The start time or null. ``` -------------------------------- ### Stringable::start Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Ensures the string starts with the given prefix. ```APIDOC ## Stringable::start ### Description Ensures the string starts with the given prefix. ### Method start ### Parameters - `$prefix` (string) - Required - The prefix to ensure. ### Return Value - `static` - A new Stringable instance with the prefix prepended if not already present. ``` -------------------------------- ### Reading configuration and env Source: https://github.com/laravel/framework/blob/13.x/_autodocs/configuration.md Example showing typed access to configuration via Config::boolean() and config() helper, and reading environment variables with Env::get() and Env::getOrFail(). The try-catch handles missing variables by catching RuntimeException. ```php use Illuminate\Support\Facades\Config; use Illuminate\Support\Env; $debug = Config::boolean('app.debug'); // typed access $db = config('database.connections.mysql.host'); if (Env::get('APP_ENV') === 'local') { // Local-only behavior } try { $apiKey = Env::getOrFail('THIRD_PARTY_KEY'); } catch (RuntimeException $e) { // Variable missing } ``` -------------------------------- ### get($uri, $action = null) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/routing-router.md Registers a GET route (and HEAD) for the given URI and action. Returns a Route instance. ```APIDOC ## GET get($uri, $action = null) ### Description Registers a GET route (and HEAD) for the given URI and action. ### Method GET ### Parameters - **$uri** (string) - Required - The URI pattern for the route. - **$action** (mixed) - Optional - Closure, Controller@method string, or array of route attributes. ### Returns Route ``` -------------------------------- ### Example: listening and dispatching Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/events-dispatcher.md Shows how to register listeners using Event::listen with closures or class-based listeners, and how to dispatch events using event() helper, Event::dispatch, and Event::until. The until method halts after the first non-null listener response. ```php use Illuminate\Support\Facades\Event; Event::listen('user.registered', function (User $user) { Log::info('User registered', ['id' => $user->id]); }); Event::listen(UserRegistered::class, SendWelcomeEmail::class); event(new UserRegistered($user)); // object event Event::dispatch('user.registered', [$user]); // string event $first = Event::until('payment.handled', [$payment]); // halt after first non-null ``` -------------------------------- ### Container binding and resolution example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/container.md Shows how to bind a class and a singleton closure, then resolve them. The singleton returns the same instance each time via array access. ```php use Illuminate\Container\Container; $container = new Container; $container->bind(LoggerInterface::class, FileLogger::class); $container->singleton(EventDispatcher::class, fn ($c) => new EventDispatcher($c->make(LoggerInterface::class))); $logger = $container->make(LoggerInterface::class); $events = $container[EventDispatcher::class]; // same instance each time (singleton) ``` -------------------------------- ### Application usage example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-helpers.md Shows common support helpers like config(), auth(), storage_path(), redirect(), and __() in a typical controller flow. ```php $config = config('app.name'); $user = auth()->user(); $path = storage_path('app'.DIRECTORY_SEPARATOR.'files'); return redirect()->route('dashboard')->with('status', __('Saved.')); ``` -------------------------------- ### Stringable::startsWith Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Determines if the string starts with the given value(s). ```APIDOC ## Stringable::startsWith ### Description Determines if the string starts with the given value(s). ### Method startsWith ### Parameters - `$needles` (string|array) - Required - The value(s) to check. ### Return Value - `bool` - True if the string starts with any of the given values, false otherwise. ``` -------------------------------- ### Failure handling and isolation example with fail() method Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/console-command.md Example showing how to use the fail() method to throw a ManuallyFailedException and set an isolated command. When isolation blocks the run, execute() prints 'The [deploy] command is already running.' and returns $isolatedExitCode. ```php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Console\ManuallyFailedException; class Deploy extends Command { protected $signature = 'deploy --isolated'; protected $isolated = true; // + $isolatedExitCode = self::FAILURE public function handle(): int { try { $this->runSteps(); } catch (\Throwable $e) { $this->fail('Deployment failed: '.$e->getMessage()); // exit code 1 } return self::SUCCESS; } } ``` -------------------------------- ### Custom middleware registration example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Shows how to register middleware on the HTTP kernel: prepend a global middleware, push another, and append to the 'web' group. ```php use Illuminate\Contracts\Http\Kernel; $kernel = $app->make(Kernel::class); $kernel->prependMiddleware(\App\Http\Middleware\TrustProxies::class); $kernel->pushMiddleware(\App\Http\Middleware\EnsureFrontendRequestsAreStateful::class); $kernel->appendMiddlewareToGroup('web', \App\Http\Middleware\Localize::class); ``` -------------------------------- ### basePath($path = '') Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns the installation root path, optionally joined with a relative path. This is a path getter that returns an absolute path. ```APIDOC ## basePath($path = '') ### Description Returns the installation root path, optionally joined with a relative path. ### Method basePath ### Parameters - **$path** (string) - Optional - Relative path to append to the base path. ### Returns - **string** - Absolute path to the installation root with optional appended path. ``` -------------------------------- ### Reading configuration with Config facade and helper Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/config-repository.md Shows how to retrieve configuration values using the Config facade's get method with a fallback, the config() helper, and getMany for multiple keys. ```php use Illuminate\Support\Facades\Config; $driver = Config::get('database.default', 'sqlite'); // with fallback $name = config('app.name'); // helper equivalent [$database, $cache] = Config::getMany(['database.default', 'cache.default']); ``` -------------------------------- ### Error-handling helpers example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-helpers.md Demonstrates rescue(), throw_if(), data_get() with throw, and report() for error handling. ```php $value = rescue(function () { return riskyOperation(); }, 'fallback', report: true); throw_if($value < 0, InvalidArgumentException::class, 'Value must be positive'); try { $data = data_get($payload, 'user.profile.email', throw: true); } catch (Throwable $e) { report($e); } ``` -------------------------------- ### beginTransaction() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Starts a new database transaction. Must be paired with a corresponding commit() or rollBack() call. ```APIDOC ## beginTransaction() ### Description Starts a new database transaction. Must be paired with a corresponding commit() or rollBack() call. ### Method `beginTransaction()` ### Parameters None. ### Return Value None. ### Example ```php DB::beginTransaction(); ``` ``` -------------------------------- ### Str::startsWith Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Determines if the haystack starts with any of the given needles. ```APIDOC ## Str::startsWith ### Description Determines if the haystack starts with any of the given needles. ### Method Static method ### Signature ```php public static function startsWith($haystack, $needles): bool ``` ### Parameters - **$haystack** (string) - Required - The string to search in. - **$needles** (string|array) - Required - The needle(s) to search for. ### Return Value - **bool** - True if the haystack starts with any needle, false otherwise. ### Example ```php $result = Str::startsWith('Hello World', 'Hello'); // true ``` ``` -------------------------------- ### any($uri, $action = null) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/routing-router.md Registers a route for all HTTP verbs (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, QUERY). Returns a Route instance. ```APIDOC ## ANY any($uri, $action = null) ### Description Registers a route for all HTTP verbs (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, QUERY). ### Method ANY ### Parameters - **$uri** (string) - Required - The URI pattern for the route. - **$action** (mixed) - Optional - Closure, Controller@method string, or array of route attributes. ### Returns Route ``` -------------------------------- ### beforeStartingTransaction(Closure $callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Registers a callback to be executed before starting a transaction. This is part of the error/lifecycle hooks and returns void. ```APIDOC ## beforeStartingTransaction(Closure $callback) ### Description Registers a callback to be executed before starting a transaction. ### Method beforeStartingTransaction ### Parameters - **$callback** (Closure) - Required - The callback to execute. ### Return Value void ``` -------------------------------- ### get($key, $default = null): mixed Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/config-repository.md Retrieves a configuration value by dot-notation key. If an array of keys is provided, returns an array of values for each key. ```APIDOC ## get($key, $default = null): mixed ### Description Gets a configuration value. If `$key` is an array, returns an array of values for each key. ### Parameters - `$key` (string|array) - Required - The dot-notation key or array of keys. - `$default` (mixed) - Optional - Default value if key not found. Defaults to `null`. ### Returns - `mixed` - The configuration value, or default if not found. ### Example ```php $driver = Config::get('database.default', 'sqlite'); ``` ``` -------------------------------- ### boot() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Boots the application. Runs all booting callbacks, boots every registered provider, then fires booted callbacks. ```APIDOC ## boot() ### Description Boots the application. Runs all booting callbacks, boots every registered provider, then fires booted callbacks. ### Method boot ### Returns - **void** ``` -------------------------------- ### Default-driver error handling example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-manager.md Shows how to catch an `InvalidArgumentException` when using an unknown driver. Also demonstrates `getDrivers()` returning created instances and `forgetDrivers()` clearing the cache so the next access re-creates each driver. ```php use Illuminate\Support\Facades\Cache; try { Cache::store('unknown-driver')->get('key'); } catch (InvalidArgumentException $e) { // "Driver [unknown-driver] not supported." } $drivers = Cache::getDrivers(); // ['database' => Repository, ...] after first use Cache::forgetDrivers(); // next access re-creates each driver ``` -------------------------------- ### booting($callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Registers a callback to be run before the application boots. ```APIDOC ## booting($callback) ### Description Registers a callback to be run before the application boots. ### Method booting ### Parameters - **$callback** (callable) - Required - The callback to run. ### Returns - **void** ``` -------------------------------- ### Env class method signatures Source: https://github.com/laravel/framework/blob/13.x/_autodocs/configuration.md Static wrapper around the dotenv repository. Provides typed coercion for get(): 'true'→true, 'false'→false, 'empty'→'', 'null'→null, and unquotes quoted strings. getOrFail() throws RuntimeException if the variable has no value. writeVariables() and writeVariable() throw RuntimeException if the file is missing. ```php class Env { public static function enablePutenv(): void public static function disablePutenv(): void public static function extend(Closure $callback, ?string $name = null): void public static function getRepository(): \Dotenv\Repository\RepositoryInterface public static function get($key, $default = null) // mixed — typed coercion: 'true'→true, 'false'→false, 'empty'→'', 'null'→null, quoted strings unquoted public static function getOrFail($key) // mixed — @throws RuntimeException("Environment variable [$key] has no value.") public static function writeVariables(array $variables, string $pathToFile, bool $overwrite = false): void // @throws RuntimeException (missing file) public static function writeVariable(string $key, mixed $value, string $pathToFile, bool $overwrite = false): void } ``` -------------------------------- ### Route instance with metadata, parameter binding, and error handling Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/routing-route.md Creates a Route instance manually for a GET request to 'reports/{report}' with a controller action. Shows how to bind parameters from a request, set a parameter manually, attach metadata, and run the route action. Includes a try-catch for LogicException when parameters are accessed before binding, with a comment advising to call $route->bind($request) first. ```php use Illuminate\Routing\Route; $route = new Route(['GET'], 'reports/{report}', [ReportController::class, 'show']); try { $params = $route->parameters(); } catch (LogicException $e) { // Route is not bound — call $route->bind($request) first } $route->bind($request); // bind parameters from the request $route->setParameter('report', $report); $route->metadata(['cache_ttl' => 60]); $response = $route->run(); // execute the action ``` -------------------------------- ### Facade usage example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/facades.md Demonstrates typical facade usage with Cache and DB facades, showing how static calls are forwarded to underlying services. ```php use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; Cache::put('key', 'value', 60); $value = Cache::get('key'); $users = DB::table('users')->get(); ``` -------------------------------- ### Model definition and persistence example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/eloquent-model.md Shows a complete Eloquent model definition with fillable, casts, and hidden attributes, plus a HasMany relationship. Includes usage examples for creating a user, creating a related post, and destroying records by ID. ```php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; class User extends Model { protected $fillable = ['name', 'email']; protected $casts = ['email_verified_at' => 'datetime']; protected $hidden = ['password']; public function posts(): HasMany { return $this->hasMany(Post::class); } } $user = User::create(['name' => 'Ada', 'email' => 'ada@example.com']); $user->posts()->create(['title' => 'Hello']); $ids = User::destroy([1, 2]); ``` -------------------------------- ### configure Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Creates a new Application instance with the given base path and chains the necessary kernel, event, command, and provider registrations. This is the recommended bootstrap API. ```APIDOC ## configure ### Description Creates a new Application (inferring the base path from APP_BASE_PATH env, $_SERVER['APP_BASE_PATH'], or the Composer autoloader) and chains ->withKernels()->withEvents()->withCommands()->withProviders(). This is the recommended bootstrap API. ### Method Static factory method ### Signature ```php public static function configure(?string $basePath = null) ``` ### Parameters - **basePath** (?string) - Optional - The base path for the application. ### Returns - **\Illuminate\Foundation\Configuration\ApplicationBuilder** - The application builder instance. ``` -------------------------------- ### Static instance access methods Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/container.md Lists the static methods for getting and setting the global container instance. getInstance lazily creates one if none exists, and setInstance accepts a ContainerContract or null. ```php public static function getInstance() // static — returns the global container (lazily creates one) public static function setInstance(?ContainerContract $container = null) // ContainerContract|static|null ``` -------------------------------- ### Custom cache driver example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-manager.md Registers a custom cache driver named 'mongo' using `Cache::extend()`. The callback receives the application container and returns a new `MongoStore` instance. The configuration comment shows the required `config/cache.php` entry. After registration, `Cache::store('mongo')` uses the custom driver. ```php use Illuminate\Support\Facades\Cache; use Illuminate\Contracts\Cache\Store; Cache::extend('mongo', function ($app) { return new \App\Cache\MongoStore($app->make('config')->get('cache.stores.mongo')); }); // config/cache.php: // 'stores' => ['mongo' => ['driver' => 'mongo', 'connection' => 'mongo']], Cache::store('mongo')->put('key', 'value', 60); ``` -------------------------------- ### booting() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application-builder.md Registers a callback to run while the application boots. This method is part of the fluent ApplicationBuilder API. ```APIDOC ## booting() ### Description Callback run while the application boots. ### Method booting ### Signature `booting(callable $callback): $this` ### Parameters - **callback** (callable) - Required - Callback to run on 'booting'. ### Returns `$this` - for fluent chaining ``` -------------------------------- ### all(): array<string, mixed> Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/config-repository.md Returns the entire configuration tree as an array. ```APIDOC ## all(): array<string, mixed> ### Description Gets all configuration values. ### Returns - `array<string, mixed>` - The full configuration tree. ### Example ```php $all = $config->all(); ``` ``` -------------------------------- ### Invoking Artisan from code Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Example of using the kernel to call Artisan commands programmatically. call() runs the command in-process and can capture output into a buffer. ```php use Illuminate\Contracts\Console\Kernel; $kernel = $app->make(Kernel::class); $exitCode = $kernel->call('migrate', ['--force' => true]); $output = $kernel->call('route:list -v', outputBuffer: $buffer); ``` -------------------------------- ### getConnectionResolver Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/eloquent-model.md Gets the connection resolver instance. ```APIDOC ## getConnectionResolver ### Description Gets the connection resolver instance. ### Method Static method ### Signature `public static function getConnectionResolver(): Resolver` ### Return Value Resolver - The connection resolver instance. ``` -------------------------------- ### bootstrap() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Boots the console kernel. Returns void. ```APIDOC ## bootstrap() ### Description Boots the console kernel. ### Method bootstrap ### Parameters None ### Return Value - **void** ``` -------------------------------- ### slice Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-collection.md Returns a slice of the collection starting at the given offset. ```APIDOC ## slice ### Description Returns a slice of the collection starting at the given offset. ### Method Collection method ### Parameters - **$offset** (int) - Required - The starting offset. - **$length** (int|null) - Optional - The length of the slice. ### Returns Collection ``` -------------------------------- ### getOriginalContent() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-response.md Get the original content of the response. Returns null. ```APIDOC ## getOriginalContent() ### Description Get the original content of the response. Returns null. ### Method getOriginalContent ### Parameters None. ### Return Value - **null** - Always returns null. ``` -------------------------------- ### Manual bootstrap with Application and closure binding Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Creates a new Laravel application instance and registers a closure binding for 'greeter', then resolves it to output 'Hello'. Use this to bootstrap the framework manually without a web server. ```php use Illuminate\Foundation\Application; $app = new Application(__DIR__); // Register a closure binding… $app->bind('greeter', fn () => 'Hello'); echo $app->make('greeter'); // "Hello" ``` -------------------------------- ### Strictness and error handling example Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/eloquent-model.md Demonstrates enabling strict mode with Model::shouldBeStrict() and catching three Eloquent exceptions: ModelNotFoundException, LazyLoadingViolationException, and MissingAttributeException. Comments show the exception properties and recommended eager-loading alternative. ```php use Illuminate\Database\LazyLoadingViolationException; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\MissingAttributeException; Model::shouldBeStrict(); try { $user = User::findOrFail(404); } catch (ModelNotFoundException $e) { // $e->getModel() === User::class; $e->getIds() === [404] } try { $user->posts; // lazy load with strict mode } catch (LazyLoadingViolationException $e) { // Eager-load instead: User::with('posts')->find($id) } try { $user->does_not_exist; } catch (MissingAttributeException $e) { // declared columns only } ``` -------------------------------- ### loadEnvironmentFrom Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Sets the environment file to load from. ```APIDOC ## loadEnvironmentFrom ### Description Sets the environment file to load from. ### Method Instance method ### Signature ```php public function loadEnvironmentFrom($file) ``` ### Parameters - **file** (mixed) - Required - The environment file name. ### Returns - **$this** - The application instance for chaining. ``` -------------------------------- ### getTablePrefix() / setTablePrefix($prefix) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Gets or sets the table prefix. This is part of the connection lifecycle. ```APIDOC ## getTablePrefix() / setTablePrefix($prefix) ### Description Gets or sets the table prefix. ### Method getTablePrefix / setTablePrefix ### Parameters - **$prefix** (string) - Required for setTablePrefix - The table prefix. ### Return Value string (for getTablePrefix) / void (for setTablePrefix) ``` -------------------------------- ### booting(Closure $callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/service-provider.md Registers a callback to be run before the provider is booted. This allows you to hook into the booting process. ```APIDOC ## booting(Closure $callback) ### Description Registers a callback to be run before the provider is booted. This allows you to hook into the booting process. ### Method booting ### Signature public function booting(Closure $callback) ### Parameters - **$callback** (Closure) - Required - The callback to execute before booting. ### Returns void ``` -------------------------------- ### getDatabaseName() / setDatabaseName($database) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Gets or sets the database name. This is part of the connection lifecycle. ```APIDOC ## getDatabaseName() / setDatabaseName($database) ### Description Gets or sets the database name. ### Method getDatabaseName / setDatabaseName ### Parameters - **$database** (string) - Required for setDatabaseName - The database name. ### Return Value string (for getDatabaseName) / void (for setDatabaseName) ``` -------------------------------- ### create() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application-builder.md Returns the configured Application instance. This method is part of the fluent ApplicationBuilder API. ```APIDOC ## create() ### Description Returns the configured `Application` instance. ### Method create ### Signature `create(): Application` ### Parameters None ### Returns `Application` - The configured application instance. ``` -------------------------------- ### get Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/cache-repository.md Retrieves the value for a given key, or returns a default if the key does not exist or is expired. ```APIDOC ## get ### Description Retrieves the value for a given key, or returns a default if the key does not exist or is expired. ### Method get ### Signature `get($key, $default = null): mixed` ### Parameters - `$key` (mixed) - Required - The cache key. - `$default` (mixed) - Optional - The default value to return if the key is not found. Default: `null`. ### Returns - mixed - The cached value or the default value. ``` -------------------------------- ### environmentFile Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns the environment file name. ```APIDOC ## environmentFile ### Description Returns the environment file name. ### Method Instance method ### Signature ```php public function environmentFile() ``` ### Returns - **string** - The environment file name. ``` -------------------------------- ### Stringable::doesntStartWith Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Determines if the string does not start with the given value(s). ```APIDOC ## Stringable::doesntStartWith ### Description Determines if the string does not start with the given value(s). ### Method doesntStartWith ### Parameters - `$needles` (string|array) - Required - The value(s) to check. ### Return Value - `bool` - True if the string does not start with any of the given values, false otherwise. ``` -------------------------------- ### Str::doesntStartWith Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Determines if the haystack does not start with any of the given needles. ```APIDOC ## Str::doesntStartWith ### Description Determines if the haystack does not start with any of the given needles. ### Method Static method ### Signature ```php public static function doesntStartWith($haystack, $needles): bool ``` ### Parameters - **$haystack** (string) - Required - The string to search in. - **$needles** (string|array) - Required - The needle(s) to search for. ### Return Value - **bool** - True if the haystack does not start with any needle, false otherwise. ### Example ```php $result = Str::doesntStartWith('Hello World', 'Foo'); // true ``` ``` -------------------------------- ### boot() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/service-provider.md Boots the service provider. This method is invoked by the application when the provider is booted and is intended to be overridden in subclasses to perform actions after all providers are registered. ```APIDOC ## boot() ### Description Boots the service provider. This method is invoked by the application when the provider is booted and is intended to be overridden in subclasses to perform actions after all providers are registered. ### Method boot ### Signature public function boot() ### Returns void ``` -------------------------------- ### booted($callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Registers a callback to be run after the application boots. ```APIDOC ## booted($callback) ### Description Registers a callback to be run after the application boots. ### Method booted ### Parameters - **$callback** (callable) - Required - The callback to run. ### Returns - **void** ``` -------------------------------- ### getException / setException Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/validation-validator.md Get or set the exception class or instance thrown by `validate()`. The default is `ValidationException`. ```APIDOC ## getException / setException ### Description Get or set the exception class or instance thrown by `validate()`. The default is `ValidationException`. ### Method GET / POST ### Endpoint `getException()` / `setException($exception)` ### Parameters #### Request Body (for setException) - **$exception** (mixed) - Required - The exception class or instance. ### Response #### Success Response (getException) - **mixed** - The exception class or instance. #### Success Response (setException) - **void** - No return value. ``` -------------------------------- ### environmentFilePath Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns the full path to the environment file. ```APIDOC ## environmentFilePath ### Description Returns the full path to the environment file. ### Method Instance method ### Signature ```php public function environmentFilePath() ``` ### Returns - **string** - The full path to the environment file. ``` -------------------------------- ### Stringable::replaceStart Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Replaces the given search at the start of the string if it exists. ```APIDOC ## Stringable::replaceStart ### Description Replaces the given search at the start of the string if it exists. ### Method replaceStart ### Parameters - `$search` (string) - Required - The value to search for. - `$replace` (string) - Required - The replacement value. ### Return Value - `static` - A new Stringable instance with the start replaced. ``` -------------------------------- ### getTranslator / setTranslator Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/validation-validator.md Get or set the translator instance used for error messages. The translator is responsible for localization. ```APIDOC ## getTranslator / setTranslator ### Description Get or set the translator instance used for error messages. ### Method GET / POST ### Endpoint `getTranslator()` / `setTranslator(Translator $translator)` ### Parameters #### Request Body (for setTranslator) - **$translator** (Translator) - Required - The translator instance. ### Response #### Success Response (getTranslator) - **Translator** - The translator instance. #### Success Response (setTranslator) - **void** - No return value. ``` -------------------------------- ### fallback($action) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/routing-router.md Registers a fallback route that matches GET /{fallbackPlaceholder} with pattern .*. Returns a Route instance. ```APIDOC ## GET fallback($action) ### Description Registers a fallback route that matches GET /{fallbackPlaceholder} with pattern .*. ### Method GET ### Parameters - **$action** (mixed) - Required - Closure, Controller@method string, or array of route attributes. ### Returns Route ``` -------------------------------- ### version Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns the version of the application framework. ```APIDOC ## version ### Description Returns the version of the application framework. ### Method Instance method ### Signature ```php public function version() ``` ### Returns - **string** - The version string (static::VERSION). ``` -------------------------------- ### Str::slug, Str::of, Str::orderedUuid, Str::is usage Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Demonstrates common Str methods: slug generation with a custom separator, fluent string manipulation with camel and title cases, ordered UUID creation, and pattern matching with Str::is. The slug example returns 'laravel-framework' and the title example returns 'John Doe'. ```php use Illuminate\Support\Str; $slug = Str::slug('Laravel Framework', '-'); // "laravel-framework" $name = Str::of('john doe')->camel()->title(); // "John Doe" $uuid = Str::orderedUuid(); if (Str::is('*.example.com', 'api.example.com')) { // … } ``` -------------------------------- ### ServiceProvider callback and command methods Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/service-provider.md Methods for registering and invoking boot callbacks, and for registering Artisan commands. commands() accepts a class, array, or variadic arguments. ```php public function booting(Closure $callback) // void public function booted(Closure $callback) // void public function callBootingCallbacks() // void public function callBootedCallbacks() // void public function commands($commands) // void — registers Artisan commands (class|array|variadic) ``` -------------------------------- ### Stringable::substr Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Returns a portion of the string specified by the start and length parameters. ```APIDOC ## Stringable::substr ### Description Returns a portion of the string specified by the start and length parameters. ### Method substr ### Parameters - `$start` (int) - Required - The starting position. - `$length` (int|null) - Optional - The length of the substring. Defaults to null (to end). ### Return Value - `static` - A new Stringable instance with the substring. ``` -------------------------------- ### Constructor Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Creates a new database connection instance with the given PDO instance or closure, database name, table prefix, and configuration options. ```APIDOC ## Constructor ### Description Creates a new database connection instance. ### Method __construct ### Signature ```php public function __construct($pdo, $database = '', $tablePrefix = '', array $config = []) ``` ### Parameters - `$pdo` (\PDO|\Closure(): \PDO) - Required - PDO instance or closure producing one. - `$database` (string) - Optional - Database name. Default: `''`. - `$tablePrefix` (string) - Optional - Table prefix applied to queries. Default: `''`. - `$config` (array) - Optional - Connection options (driver, host, charset, strict, etc.). Default: `[]`. ``` -------------------------------- ### environmentPath Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns the path to the environment file directory. ```APIDOC ## environmentPath ### Description Returns the path to the environment file directory. ### Method Instance method ### Signature ```php public function environmentPath() ``` ### Returns - **string** - The environment path. ``` -------------------------------- ### Str::substr Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Returns a substring of the given string. Supports start, length, and encoding parameters. ```APIDOC ## Str::substr ### Description Returns a substring of the given string. Supports start, length, and encoding parameters. ### Method Static method ### Signature ```php public static function substr($string, $start, $length = null, $encoding = 'UTF-8'): string ``` ### Parameters - **$string** (string) - Required - The string to extract from. - **$start** (int) - Required - The starting position. - **$length** (int|null) - Optional - The length of the substring. If null, the rest of the string is returned. - **$encoding** (string) - Optional - The character encoding. Defaults to 'UTF-8'. ### Return Value - **string** - The extracted substring. ### Example ```php $result = Str::substr('Hello World', 6); // 'World' ``` ``` -------------------------------- ### requestStartedAt() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Returns the timestamp when the current request started, or null if not available. This can be used to measure request lifecycle duration. ```APIDOC ## requestStartedAt() ### Description Returns the timestamp when the current request started, or null if not available. This can be used to measure request lifecycle duration. ### Method requestStartedAt ### Parameters None ### Return Value - **Carbon|null** - The start time of the request, or null if not set. ``` -------------------------------- ### handle($input, $output = null) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Boots the console kernel, resolves the Artisan application, runs the command, and calls terminate() against the output stream. Returns the exit status as an integer. ```APIDOC ## handle($input, $output = null) ### Description Boots the console kernel, resolves the Artisan application, runs the command, and finally calls `terminate()` against the output stream. ### Method handle ### Parameters - **$input** (mixed) - Required - The input to handle. - **$output** (mixed) - Optional - The output stream. ### Return Value - **int** - Exit status. ``` -------------------------------- ### get(string $id): mixed Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/container.md PSR-11 method to retrieve an entry from the container. Throws EntryNotFoundException if the entry is not found and CircularDependencyException on circular dependencies. ```APIDOC ## get(string $id): mixed ### Description PSR-11 method to retrieve an entry from the container. Throws EntryNotFoundException if the entry is not found and CircularDependencyException on circular dependencies. ### Method get ### Parameters - **$id** (string) - Required - The identifier of the entry to retrieve. ### Return Value mixed - The resolved entry. ### Exceptions - EntryNotFoundException - CircularDependencyException ``` -------------------------------- ### prepareBindings Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Prepares bindings for use in a query. ```APIDOC ## prepareBindings ### Description Prepares bindings for use in a query. ### Method prepareBindings ### Signature ```php public function prepareBindings(array $bindings) ``` ### Parameters - `$bindings` (array) - Required - Bindings to prepare. ### Return Value - `array` - Prepared bindings. ``` -------------------------------- ### Constructor Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/cache-repository.md Creates a new cache repository instance wrapping a given store and configuration options. ```APIDOC ## Constructor ### Description Creates a new cache repository instance wrapping a given store and configuration options. ### Method __construct ### Signature `__construct(Store $store, array $config = [])` ### Parameters - `$store` (Illuminate\Contracts\Cache\Store) - Required - The backend store. - `$config` (array) - Optional - Options; honors `prefix`, `default` (default TTL seconds), `events` (bool), `serialize` (bool). Default: `[]`. ``` -------------------------------- ### hasBeenBootstrapped() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Checks if the application has been bootstrapped. ```APIDOC ## hasBeenBootstrapped() ### Description Checks if the application has been bootstrapped. ### Method hasBeenBootstrapped ### Returns - **bool** - True if bootstrapped, false otherwise. ``` -------------------------------- ### all() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Returns all registered commands as an array of Command instances. ```APIDOC ## all() ### Description Returns all registered commands. ### Method all ### Parameters None ### Return Value - **array<string, Command>** - All registered commands. ``` -------------------------------- ### getRouteResolver() / setRouteResolver(Closure $callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-request.md Gets or sets the route resolver closure. The getter returns the current resolver, the setter returns the request instance. ```APIDOC ## getRouteResolver() / setRouteResolver(Closure $callback) ### Description Gets or sets the route resolver closure. The getter returns the current resolver, the setter returns the request instance. ### Method getRouteResolver / setRouteResolver ### Parameters (setter) - **$callback** (Closure) - Required - The route resolver closure. ### Returns - **Closure** (getter) - The current route resolver. - **$this** (setter) - The request instance. ``` -------------------------------- ### getUserResolver() / setUserResolver(Closure $callback) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-request.md Gets or sets the user resolver closure. The getter returns the current resolver, the setter returns the request instance. ```APIDOC ## getUserResolver() / setUserResolver(Closure $callback) ### Description Gets or sets the user resolver closure. The getter returns the current resolver, the setter returns the request instance. ### Method getUserResolver / setUserResolver ### Parameters (setter) - **$callback** (Closure) - Required - The user resolver closure. ### Returns - **Closure** (getter) - The current user resolver. - **$this** (setter) - The request instance. ``` -------------------------------- ### bootstrapWithoutBootingProviders() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-kernel.md Boots the console kernel without booting providers. Returns void. ```APIDOC ## bootstrapWithoutBootingProviders() ### Description Boots the console kernel without booting providers. ### Method bootstrapWithoutBootingProviders ### Parameters None ### Return Value - **void** ``` -------------------------------- ### get(string $key, mixed $default = null): mixed Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/http-request.md Retrieves an input value by key. This method is deprecated; use the input() method instead. ```APIDOC ## get(string $key, mixed $default = null): mixed ### Description Retrieves an input value by key. This method is deprecated; use the input() method instead. ### Method get ### Parameters - **$key** (string) - Required - The key to retrieve. - **$default** (mixed) - Optional - Default value if the key is not found. ### Returns - **mixed** - The input value. ``` -------------------------------- ### getLoadedProviders() Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/application.md Returns an array of loaded providers with boolean values indicating whether they are booted. ```APIDOC ## getLoadedProviders() ### Description Returns an array of loaded providers with boolean values indicating whether they are booted. ### Method getLoadedProviders ### Returns - **array<string, bool>** - Array of provider class names as keys and booted status as values. ``` -------------------------------- ### Configure Capsule Manager for Database Source: https://github.com/laravel/framework/blob/13.x/src/Illuminate/Database/README.md Creates a Capsule manager instance, configures a MySQL connection, and optionally sets the event dispatcher, makes the instance global, and boots Eloquent. Requires the illuminate/events package when using observers with Eloquent. ```PHP use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]); // Set the event dispatcher used by Eloquent models... (optional) use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; $capsule->setEventDispatcher(new Dispatcher(new Container)); // Make this Capsule instance available globally via static methods... (optional) $capsule->setAsGlobal(); // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) $capsule->bootEloquent(); ``` -------------------------------- ### Stringable::betweenFirst Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/support-str.md Returns the substring between the first occurrence of the given start and end values. If not found, returns the original string. ```APIDOC ## Stringable::betweenFirst ### Description Returns the substring between the first occurrence of the given start and end values. ### Method betweenFirst ### Parameters - `$from` (string) - Required - The starting value. - `$to` (string) - Required - The ending value. ### Return Value - `static` - A new Stringable instance with the substring between the given values. ``` -------------------------------- ### options($uri, $action = null) Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/routing-router.md Registers an OPTIONS route for the given URI and action. Returns a Route instance. ```APIDOC ## OPTIONS options($uri, $action = null) ### Description Registers an OPTIONS route for the given URI and action. ### Method OPTIONS ### Parameters - **$uri** (string) - Required - The URI pattern for the route. - **$action** (mixed) - Optional - Closure, Controller@method string, or array of route attributes. ### Returns Route ``` -------------------------------- ### unprepared Source: https://github.com/laravel/framework/blob/13.x/_autodocs/api-reference/database-connection.md Executes an unprepared SQL statement and returns whether it was successful. ```APIDOC ## unprepared ### Description Executes an unprepared SQL statement and returns whether it was successful. ### Method unprepared ### Signature ```php public function unprepared($query) ``` ### Parameters - `$query` (string) - Required - SQL statement. ### Return Value - `bool` - True if successful, false otherwise. ```