bigya/talibphp

talibphp — a simple, efficient PHP framework with Phinx migrations and a built-in admin panel.

Maintainers

Package info

github.com/bigyabajracharya/talibphp

Type:project

pkg:composer/bigya/talibphp

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-05-29 18:44 UTC

This package is auto-updated.

Last update: 2026-05-29 18:44:58 UTC


README

A simple, efficient PHP framework with Phinx database migrations, PSR-4 autoloading, and a built-in admin panel — no bloat, no magic.

Requirements

  • PHP >= 7.4
  • Apache with mod_rewrite enabled
  • MySQL / MariaDB
  • Composer

Installation

composer create-project bigya/talibphp my-project

This will:

  • Download the framework
  • Run composer install
  • Copy phinx.php.examplephinx.php
  • Create error.log and uploads/ directories
  • Print your next steps

Quick Start

1. Configure your database

Open phinx.php and update the development credentials:

'development' => [
    'adapter' => 'mysql',
    'host'    => 'localhost',
    'name'    => 'your_db_name',
    'user'    => 'root',
    'pass'    => 'your_password',
    'port'    => '3306',
    'charset' => 'utf8',
],

2. Run migrations

vendor/bin/phinx migrate

3. Seed the default admin user

vendor/bin/phinx seed:run -s AdminSeeder

4. Set up your web server

Point Apache's DocumentRoot to the project root (not /public). The .htaccess routes all traffic to public/ automatically.

5. Log in to the admin panel

Visit http://localhost/your-project/admin

Field Value
Email admin@example.com
Password TalibPHP2026!

Change these immediately after first login by editing db/seeds/AdminSeeder.php and re-seeding, or updating directly in the database.

Directory Structure

my-project/
├── .htaccess              → Routes all traffic to public/ (hides it from URLs)
├── phinx.php              → Your DB credentials (gitignored)
├── phinx.php.example      → Template — safe to commit
├── error.log              → Runtime error log (gitignored)
│
├── config/
│   ├── db.php             → getPDOConnection() + path constants
│   └── error_logging.php  → logMessage() + error settings
│
├── src/                   → PSR-4 autoloaded (App\)
│   └── Helpers/
│       ├── Helper.php     → slugify(), uploadImage()
│       └── AdminAuth.php  → login(), check(), requireLogin(), logout()
│
├── db/
│   ├── migrations/        → Phinx migration files
│   └── seeds/             → Phinx seeders
│
└── public/                → Web root
    ├── index.php           → Your homepage
    ├── includes/
    │   ├── header.php
    │   └── footer.php
    └── admin/             → Admin panel
        ├── index.php      → Login
        ├── dashboard.php
        ├── logout.php
        └── includes/
            ├── header.php → Sidebar + auth guard
            └── footer.php

Creating Migrations

vendor/bin/phinx create CreatePostsTable

Edit the generated file in db/migrations/:

public function up(): void
{
    $table = $this->table('posts');
    $table->addColumn('title', 'string', ['limit' => 255])
          ->addColumn('slug', 'string', ['limit' => 255])
          ->addColumn('body', 'text')
          ->addColumn('sort_order', 'integer', ['default' => 0])
          ->addTimestamps()
          ->addIndex(['slug'], ['unique' => true])
          ->create();
}

public function down(): void
{
    $this->table('posts')->drop()->save();
}

Then run:

vendor/bin/phinx migrate

Helper Classes

App\Helpers\Helper

use App\Helpers\Helper;

// Generate a URL-safe slug
Helper::slugify('Hello World!'); // → "hello-world"

// Upload an image, returns filename or null
Helper::uploadImage($_FILES['image'], '../../uploads/');

App\Helpers\AdminAuth

use App\Helpers\AdminAuth;

// Guard a page — redirects to /admin if not logged in
AdminAuth::requireLogin();

// Handle login form POST
if (AdminAuth::login($email, $password, $pdo)) { ... }

// Check session
AdminAuth::check(); // → bool

// Logout
AdminAuth::logout();

Admin Page Pattern

Every admin CRUD page follows this structure:

<?php
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../config/db.php';
require_once __DIR__ . '/../../config/error_logging.php';
use App\Helpers\AdminAuth;

AdminAuth::requireLogin();
$pdo = getPDOConnection();

// Handle POST, fetch data...

include 'includes/header.php';
?>

<!-- Your HTML here -->

<?php include 'includes/footer.php'; ?>

Phinx Reference

vendor/bin/phinx migrate              # Run all pending migrations
vendor/bin/phinx rollback             # Roll back the last migration
vendor/bin/phinx create CreateTable   # Create a new migration
vendor/bin/phinx seed:run             # Run all seeders
vendor/bin/phinx seed:run -s Name     # Run a specific seeder
vendor/bin/phinx migrate -e production # Run on production environment
vendor/bin/phinx status               # Show migration status

License

MIT © Bigya Bajracharya