Day 36 at Stafify: Beginning PHP Migration

Today I began the hands-on work of converting our system from Google Apps Script to PHP, focusing initially on understanding the new development environment and migrating our first module. The transition marks a significant technical shift, with both challenges and opportunities emerging as I dive into the code.

My morning started with setting up a proper PHP development environment. I installed XAMPP to create a local Apache/MySQL/PHP stack, configured PHP 8.1 with appropriate extensions, and established a connection to our newly created MySQL database. After setting up the environment, I installed Composer for dependency management and initialized a new project using the Laravel framework, which we selected for its elegant syntax, robust feature set, and excellent documentation.

The first critical step was designing the database schema for our user authentication module. Converting from Google Sheets’ flat structure to a relational database required careful consideration of table relationships and normalization principles. I created migrations for our core tables—users, roles, permissions, and authentication logs—with appropriate foreign key relationships and indexing strategies to optimize query performance. This more structured approach already shows promise for improving data integrity compared to our previous system.

After establishing the database foundation, I began translating our authentication logic from Apps Script to PHP. The conceptual flow remained similar—validating credentials, generating secure tokens, establishing sessions—but the implementation details differed significantly between platforms. I had to carefully reimplement security measures like password hashing and verification using PHP’s native functions instead of Apps Script’s utilities.

One particular challenge was handling session management differently. In Apps Script, we relied heavily on PropertiesService for storing session data, but in PHP, we’re leveraging Laravel’s more sophisticated session handling capabilities. This required rethinking how we track user state and maintain authentication across requests. The new implementation actually improves security by using HTTP-only cookies and implementing CSRF protection, which weren’t easily available in our previous environment.

I also started adapting our user registration flow, which proved more complex than anticipated. The original implementation had numerous spreadsheet-specific optimizations that needed complete reimagining for a relational database context. I redesigned the registration process to leverage Laravel’s validation capabilities for input sanitization and implemented proper error handling that provides more detailed feedback than our previous system could offer.

By late afternoon, I had a functioning basic authentication system with login and registration capabilities working in the new PHP environment. I created comprehensive unit tests to verify the functionality matches our original implementation, ensuring we maintain feature parity during the migration.

Tomorrow I’ll continue with user profile management and permission handling, which are more complex aspects of the authentication module. While the migration requires significant effort, I’m already seeing benefits in code organization, performance, and security that validate our decision to transition to this more robust architecture.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
© 2025 Andrea Anne Orca. All Rights Reserved.