skhoolar/schoolkit

SchoolKit is a simple, modular micro-framework for building school applications (MySQL only)

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/skhoolar/schoolkit

dev-main 2025-09-01 09:51 UTC

This package is auto-updated.

Last update: 2025-12-31 00:28:27 UTC


README

For documentation please go to https://schoolkit.skhoolar.com/

⚠️ MySQL/MariaDB ONLY - This library is specifically designed for MySQL/MariaDB databases and does not support PostgreSQL or SQLite.

SchoolKit is a simple, modular micro-framework for building school applications. It provides a clean, simple API for database operations, mail handling, file management, and more.

Requirements

  • PHP 8.2 or higher
  • ext-pdo extension
  • MySQL 5.7+ or MariaDB 10.3+

Installation

Install via Composer:

composer require skhoolar/schoolkit

🚀 Quick Start with Test Database

Try SchoolKit instantly with our hosted test database - no setup required!

Connection Example:

<?php
require_once 'schoolkit.php';

$config = [
    'db' => [
        'dsn' => 'mysql:host=localhost;dbname=schoolkit;charset=utf8mb4',
        'user' => 'your_username',
        'pass' => 'your_password'
    ],
    'storage_path' => __DIR__ . '/storage'
];

$schoolkit = SchoolKit::start($config);

// Ready to use immediately!
$auth = $schoolkit->auth();
$directory = $schoolkit->directory();
$ptc = $schoolkit->ptc();
$asa = $schoolkit->asa();

Try It Now:

// Create a test student
$studentId = $directory->createStudent([
    'first_name' => 'Demo',
    'last_name' => 'Student',
    'email' => 'demo@example.com',
    'grade_level' => '9'
]);

// List all students
$students = $directory->listStudents();
echo "Total students: " . count($students);

⚠️ Important Notes:

  • Database resets every 24 hours at 2 AM UTC
  • All test data is wiped daily
  • Perfect for demos, testing, and evaluation
  • Do not store important data - use for testing only
  • SSL connection required

What's Included:

  • ✅ Complete SchoolKit schema with all tables
  • ✅ Sample students, teachers, and classes
  • ✅ Example ASA activities and PTC appointment slots
  • ✅ Test user accounts for authentication demos
  • ✅ All migrations pre-applied

Test Accounts:

Admin User: admin@test.com / password123
Teacher: teacher@test.com / password123
Student: student@test.com / password123

Quick Start

1. Basic Configuration

<?php
require_once 'vendor/autoload.php';

use Skhoolar\SchoolKit\SchoolKit;

$config = [
    'db' => [
        'dsn' => 'mysql:host=127.0.0.1;dbname=schoolkit;charset=utf8mb4',
        'user' => 'your_username',
        'pass' => 'your_password'
    ],
    'storage_path' => __DIR__ . '/storage'
];

$schoolKit = SchoolKit::start($config);

2. Using Modules

// Directory module
$studentId = $schoolKit->directory()->createStudent([
    'first_name' => 'John',
    'last_name' => 'Doe',
    'grade_level' => '10'
]);

// PTC module
$slotsCreated = $schoolKit->ptc()->createSlots(
    1,                // teacherId
    '2024-03-15',     // date
    '14:00:00',       // startTime
    '17:00:00',       // endTime
    20                // slotMinutes
);

// ASA module
$activityId = $schoolKit->asa()->createActivity([
    'title' => 'Basketball Club',
    'season' => 'Fall 2024',
    'day_of_week' => 1,
    'start_time' => '15:30:00',
    'end_time' => '17:00:00',
    'capacity' => 20
]);

// Messaging module
$messageId = $schoolKit->messaging()->create([
    'subject' => 'Welcome!',
    'body_text' => 'Welcome to our school!'
]);

// Auth module
$userId = $schoolKit->auth()->register([
    'email' => 'teacher@school.edu',
    'password' => 'secure_password',
    'first_name' => 'Alice',
    'last_name' => 'Johnson'
]);

Core Features

  • Database: Simple, secure wrapper around PDO.
  • Mail: Send emails using log or mail transport.
  • Files: Handle file uploads and storage.
  • CSRF: Protect against cross-site request forgery.
  • Events: Simple event dispatcher system.
  • Validation: Validate data against a set of rules.

Database Migrations

Run all pending migrations:

php bin/migrate.php

Database Reset Schedule

The test database automatically resets every 24 hours at 2:00 AM UTC with:

  • ✅ Fresh schema from latest migrations
  • ✅ Clean sample data for testing
  • ✅ All tables truncated and repopulated
  • ✅ Test user accounts recreated

Your test data will be lost during resets - this is intentional for a clean testing environment.

Local Development Setup

For persistent development, set up your own database:

# 1. Create local database
mysql -u root -p -e "CREATE DATABASE schoolkit_dev;"

# 2. Run migrations
php bin/migrate.php

# 3. Use local config
$config = [
    'db' => [
        'dsn' => 'mysql:host=localhost;dbname=schoolkit_dev;charset=utf8mb4',
        'user' => 'your_username',
        'pass' => 'your_password'
    ],
    'storage_path' => __DIR__ . '/storage'
];

License

MIT License - see LICENSE file for details.