Goravel playground for Laravel devs

A small, working Goravel API for Laravel developers to clone, run and read. Open a controller, a model or a migration, and the Laravel version is written right above the Go.

An independent, unofficial project. Goravel is built and maintained by the Goravel team and contributors; this repository is not affiliated with or endorsed by them. For the full feature-by-feature comparison and everything else, read the Goravel documentation.

How it works

The app is a grassroots football club API (clubs, players, fixtures and a league table), and its application code carries short comments comparing each piece to Laravel. This is the club controller's Show action:

// Show returns one club, or 404.
//
// Laravel:
//
//	public function show(Club $club): JsonResponse  // route model binding
//	{
//	    return response()->json(['data' => $club]);
//	}
//
// Goravel: no route model binding, so findClub reads {id} and loads the row.
func (r *ClubController) Show(ctx http.Context) http.Response {
	club, response := findClub(ctx)
	if response != nil {
		return response
	}

	return ctx.Response().Success().Json(http.Json{"data": club})
}

The comments cover the code a Laravel developer writes every day. The framework's own plumbing is left to the Goravel docs.

Where to look

Run it

  1. Clone the repository and copy .env.example to .env.
  2. make up starts the app, MySQL and Redis in Docker.
  3. make artisan cmd="key:generate", make artisan cmd="jwt:secret", then make run.
  4. make fresh loads a demo league; open http://localhost:8000/ for every endpoint.
  5. make test runs the suite. Change some code and watch what breaks.