craftphp / mini-skeleton
This is a mini skeleton of Craft framework.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.1
- ext-json: *
- datahihi1/tiny-env: 1.0.11
This package is auto-updated.
Last update: 2025-09-20 16:16:50 UTC
README
CraftMini is a minimalist PHP framework designed for small projects, learning, or as a foundation for personal framework development.
Features
- Routing: Flexible routing system, supporting groups, middleware, named routes, RESTful and API routes.
- View Engine: Supports multiple view engines, default is PHP, easily extendable to Blade, Twig, etc.
- Session & Flash: Manage sessions, convenient flash messages for one-time notifications.
- Database Layer:
- Supports multiple database systems (MySQL, SQLite).
- Supports multiple drivers (mysqli, sqlite3, PDO).
- Adapter pattern for connections and queries.
- Query Builder generates dynamic SQL, separated from the adapter.
- Record Mapper CRUD for each table.
- Error & Exception Handling: Error reporting, logging, runtime, parsing, separate exceptions.
- Helper: Many utility functions for debugging, var_dump, helper function.
- Environment Configuration: Read environment variables from
.env
, supported by TinyEnv. - Security: Supports secure sessions, maintenance mode, security headers, tokens generation (easily extendable).
Basic Usage
Routing:
$router = new Craft\Application\Router(); $router->get('/', [App\Controller\HomeController::class, 'index']); $router->runInstance();
Controller:
class HomeController extends Controller { public function index() { return $this->render('home', ['message' => 'Hello!']); } }
Database:
$test = new User(); $allUsers = $test->all(); // Get all users with Mapper
View:
echo Craft\Application\View::render('home', ['message' => 'Hello!']);
Session & Flash:
Craft\Application\Session::flash('msg', 'Success!'); // Set flash message echo Craft\Application\Session::getFlash('msg'); // Get and clear flash message
System Requirements
Installation
- Clone the repository:
composer install
- With Composer, you can create a new project:
composer create-project craftphp/mini-skeleton your-project-name
Contribution
Fork, create a pull request or open an issue to contribute ideas or report bugs. CraftMini is suitable for those who want to learn how to build a PHP framework from scratch or as a foundation for small projects, demos, and experimenting with new ideas.