Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Controller patterns, request handling, RESTful design.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -29% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -28% | 0% |
| case-01 | ✓→✓ | = Same ✓ | -21% | 0% |
| case-02 | ✓→✓ | = Same ✓ | -25% | 0% |
php<?php namespace App\Controllers; use CodeIgniter\RESTful\ResourceController; class UserController extends ResourceController { protected $modelName = 'App\Models\UserModel'; protected $format = 'json'; public function index() { return $this->respond($this->model->findAll()); } public function show($id = null) { $user = $this->model->find($id); if (!$user) { return $this->failNotFound(); } return $this->respond($user); } public function create() { $rules = ['email' => 'required|valid_email']; if (!$this->validate($rules)) { return $this->failValidationErrors($this->validator->getErrors()); } $id = $this->model->insert($this->request->getJSON(true)); return $this->respondCreated(['id' => $id]); } }
Other measured skills in the registry, with their headline benchmark lift.