gitwtfhub

wtf is laravel-cors?

taylorotwell/laravel-cors — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2020-10-22

20Audience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A Laravel package that lets your API safely accept requests from web pages hosted on other domains by automatically sending the right CORS permission headers.

Mindmap

mindmap
  root((repo))
    What it does
      Allow cross origin requests
      Send permission headers
      Handle preflight checks
      Configure allowed domains
    Tech stack
      PHP
      Laravel
    Use cases
      Public API access
      Separate frontend domain
      Route specific CORS
    Audience
      Laravel developers
      API builders
    Setup
      Install package
      Add middleware
      Edit config file
    Notes
      Middleware placement matters
      Watch auth headers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Let a frontend app on example.com fetch data from your API on api.example.com without browser CORS errors.

REASON 2

Configure which domains, routes, and HTTP methods are allowed to make cross-origin requests to your API.

REASON 3

Build a public API that accepts requests from any origin using wildcard CORS rules.

What's in the stack?

PHPLaravel

How it stacks up

taylorotwell/laravel-corsaaronz345/athena-personal-academic-pageabolix/xplex
Stars202020
LanguageJavaScriptGo
Last pushed2020-10-22
MaintenanceDormant
Setup difficultyeasymoderatehard
Complexity2/52/53/5
Audiencedeveloperresearcherops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Middleware placement and header handling (like authorization tokens) are common setup mistakes per the README's troubleshooting tips.

Yoink these prompts

Prompt 1
Show me how to install laravel-cors and add its middleware to my Laravel API.
Prompt 2
Write a laravel-cors config that only allows GET and POST requests from https://example.com.
Prompt 3
Explain how laravel-cors handles preflight OPTIONS requests automatically.
Prompt 4
Help me debug why my Laravel API's authorization header is being stripped after adding CORS middleware.

Frequently asked questions

wtf is laravel-cors?

A Laravel package that lets your API safely accept requests from web pages hosted on other domains by automatically sending the right CORS permission headers.

Is laravel-cors actively maintained?

Dormant — no commits in 2+ years (last push 2020-10-22).

How hard is laravel-cors to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is laravel-cors for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.