I'm looking for the best way to build a simple scheduler that will be able to render a visual calendar of the last 90 days and events that occurred during that span of time.

We will need to store the contents of the calendar in a database. I'm thinking a flat file database (plaintext file) is best since it's not that complex and I don't know MySQL at all and my PHP knowledge is limited. The visual part will be easy since I can use HTML and CSS.

This is for a small business that needs to track employee attendance history for the past 90 days.
We also want to make another calendar in a similar fashion that allows employees to log in from home to check their work schedule for the coming weeks.

I'm asking the community's opinions:
Is PHP a practical choice for building such a tool? Or does anyone know of a better-suited existing solution?

Dani AI

Generated

Building on @diafol's point about not using a plaintext file: for a small, single-server app, SQLite is a great middle ground. It is zero-admin, ACID, and far safer than flat files, while keeping the door open to migrate to MySQL/MariaDB later with minimal changes. Store timestamps in UTC, render in local time, and index by date so your 90-day queries stay fast. For the visual calendar, feed a lightweight JSON endpoint into a JS calendar widget; your API can expose /api/shifts?from=YYYY-MM-DD&to=YYYY-MM-DD and /api/attendance?... for the last 90 days and upcoming weeks employees can view from home.

Minimal schema keyed to your use case:

-- employees and their schedules/attendance
CREATE TABLE employees (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  email TEXT UNIQUE NOT NULL,
  name TEXT NOT NULL,
  is_active INTEGER NOT NULL DEFAULT 1
);

CREATE TABLE shifts (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  employee_id INTEGER NOT NULL REFERENCES employees(id),
  starts_at TEXT NOT NULL,  -- ISO 8601 UTC, e.g. 2025-09-19T09:00:00Z
  ends_at   TEXT NOT NULL,
  role TEXT
);
CREATE INDEX idx_shifts_range ON shifts(starts_at, ends_at);

CREATE TABLE attendance (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  employee_id INTEGER NOT NULL REFERENCES employees(id),
  occurred_on TEXT NOT NULL,           -- 2025-09-19
  status TEXT CHECK(status IN ('present','absent','late','excused')) NOT NULL
);
CREATE INDEX idx_attendance_date ON attendance(occurred_on);

Simple JSON feed for the last 90 days (PDO + prepared statements):

$db = new PDO('sqlite:/path/app.db', null, null, [
  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
$to = new DateTimeImmutable('now', new DateTimeZone('UTC'));
$from = $to->sub(new DateInterval('P90D'));
$sql = 'SELECT e.name, s.starts_at, s.ends_at, s.role
        FROM shifts s JOIN employees e ON e.id = s.employee_id
        WHERE s.starts_at BETWEEN :from AND :to ORDER BY s.starts_at';
$stmt = $db->prepare($sql);
$stmt->execute([':from'=>$from->format('c'), ':to'=>$to->format('c')]);
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));

Security essentials for 's login requirement: password_hash/password_verify, session_regenerate_id on login, CSRF tokens on forms, and strict authorization (employees see only their own data). This keeps @Szabi Zsoldos's hosted-tool suggestion as a fallback while giving you a safe DIY path.

Recommended Answers

All 4 Replies

You could use the Google Business Apps for this solution.

Member Avatar for Member #120589

PHP is fine for this, but using a plaintext file for your data would not be advisable (just because you don't have the skillset yet). If you want to build this yourself - it's a pretty trivial build for an experienced php-er - get to grips with MySQL or similar DB engine. Seeing as your users will be 'logging in', you'll certainly need to have considerable security in place, something that a plaintext file probably won't give you.

As szabizs mentions, there are online services available. Hundreds if not thousands of them. Some are free, some like are paid (that's just an example - I'm in no way associated with them nor have I tried their services).

If this is a critical development for your business, then I suggest a service - imagine the cost of bugs if your staff come to rely on your "beginner's app", if they take the info as "gospel".

I recently devloped a system for science resource manageement in a school. It worked well for 9 months, then inexplicably the dropdown dates widget stopped working. I scanned the code maybe 30-40 times - couldn't see anything wrong with it. It finally came to light that I'd added weekly start dates in the wrong order in MySQL and this played havoc with the code as it was working off week_id values and not the raw dates themselves. So, even if you get it running smoothly, there's no guarantee that it will keep on running and when it comes to a problem and you look at your code, will it be clean enough and DRY enough for you to remember what the hell it was each bit actually did? Sounds ridiculous, but true. Leave a project for 2 weeks and then come back to it - you'll struggle unless it's completely documented and commented, and possibly struggle even if it is.

Don't want to put you off, but if this is critical to your business, you can't afford the luxuries of getting it wrong and not being able to fix it within an acceptable period of time.

I would suggest you to try open source script like this one hosted on github to execute the staff scheduling app that supports employees attendance monitoring for the selected period (1 week, 1 month, last 2month or last 3 months and so on..)

Note that the github hosted project was a utility, written in Python, for scheduling N number of employees with the objective of both satisfying the workers’ scheduling requests and fulfilling the organization’s needs for workers per shift. The app does few good things you will need as a business.

Another option is to develop it in PHP and Mysql on your own. But you must take security issue seriously of you want to develop it in PHP, because writing a simple app in PHP is more volnurable to many attacks. Also I would suggest you to use some Php based frameworks to achieve this. On the other hand, I was also searching for similar alternative from long time, I have tried to build similar apps inspired by the some online service providers. I like staff scheduling app because of its simplicity and ease of use. I don't know the technical stuff behind this web based app but I would love to do similar app for my business requirements.

Thanks For Sharing these wonderful Tips it really helps me a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.