A stub is a template for a class.
Laravel has stub file for many classes, e.g. this is a Controller class stub which should be familiar to you; it has all of the methods stubbed out along with bracketed placeholders for dynamic information (such as the namespace and class name).
Whenever you use the php artisan make:controller command, Laravel will fetch this text file and replace the placeholders with relevant information before creating the new Controller class in the app/Http/Controllers directory using the updated text from the stub for the class file contents:
<?php
namespace {{ namespace }};
use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;
class {{ class }} extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.model.stub
Publishing stubs allows us to modify this template according to our preference; e.g. removal of docblocks, or removal of certain non-API methods like edit and create