{"id":13405034,"url":"https://github.com/taniarascia/laconia","last_synced_at":"2025-04-05T12:07:59.692Z","repository":{"id":30530065,"uuid":"125270638","full_name":"taniarascia/laconia","owner":"taniarascia","description":"🏺 ‎ A minimalist MVC framework.","archived":false,"fork":false,"pushed_at":"2024-07-09T22:07:55.000Z","size":14184,"stargazers_count":364,"open_issues_count":5,"forks_count":63,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-29T11:08:09.974Z","etag":null,"topics":["application","authentication","database","mvc","mysql","object-oriented-programming","oop","php","php-7","webapp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taniarascia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T20:37:06.000Z","updated_at":"2025-03-22T09:02:44.000Z","dependencies_parsed_at":"2024-09-28T19:41:09.795Z","dependency_job_id":"37fc4f3c-6f13-4a12-b962-738652328117","html_url":"https://github.com/taniarascia/laconia","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taniarascia%2Flaconia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taniarascia%2Flaconia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taniarascia%2Flaconia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taniarascia%2Flaconia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taniarascia","download_url":"https://codeload.github.com/taniarascia/laconia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332612,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application","authentication","database","mvc","mysql","object-oriented-programming","oop","php","php-7","webapp"],"created_at":"2024-07-30T19:01:54.832Z","updated_at":"2025-04-05T12:07:59.653Z","avatar_url":"https://github.com/taniarascia.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# 🏺 Laconia\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nAn MVC framework from scratch in PHP.\n\n## Installation\n\nInstall a local copy with the instructions below, or follow the [Docker instructions](#docker-instructions).\n\n### Install Apache, MySQL, and PHP\n\nIt is assumed you already know how to install a LAMP stack. For macOS and Windows local development, I would recommend downloading [MAMP](https://www.mamp.info/en/) for a sandboxed environment. You can [set up virtual hosts](https://www.taniarascia.com/setting-up-virtual-hosts/) as well.\n\nIf using MAMP, add MAMP to the PHP command line by adding this line to `.bash_profile`.\n\n```bash\nexport PATH=/Applications/MAMP/bin/php/php7.2.1/bin:$PATH\n```\n\n### Install Composer\n\n[Composer](https://getcomposer.org/) is the standard in PHP for dependency management, class autoloading, and much more.\n\n```bash\ncurl -sS https://getcomposer.org/installer | php\nsudo mv composer.phar /usr/local/bin/composer\n```\n\n### Set up server\n\nCreate a virtual host called `laconia.server`. The server should point to the `/public` directory. Your `httpd-vhosts.conf` will look like this:\n\n```apacheconf\n\u003cVirtualHost *:80\u003e\n    DocumentRoot \"/Users/tania/hosts/laconia/public\"\n    ServerName laconia.server\n\u003c/VirtualHost\u003e\n```\n\n### Run install script\n\n- Run `php bin/install.php` in the root directory to initialize the database.\n- Run `composer install` to autoload classes and configuration.\n- Run `npm i` to install depencencies to use Sass.\n- Run `npm run sass` to run sass.\n\nCopy credentials example file to credentials.\n\n```bash\ncp credentials.example.php credentials.php\n```\n\nLaconia is all set up and ready to use!\n\n### Docker Instructions\n\n- Run `make init` to build all containers.\n- Run `make install` to run the install script.\n\n`npm` and `sass` are not integrated in Docker at the moment.\n\n- Run `npm i` to install depencencies to use Sass.\n- Run `npm run sass` to run sass.\n\n#### Autoload classes\n\nIf you change or add a class at anytime, you'll need to re-run the autoload script to re-load the new classes.\n\n```bash\ncomposer dump-autoload\n```\n\n## Project Structure\n\nThe entire program flows through `/public/index.php`, and the rest of the project is a directory above public.\n\n```bash\nlaconia/\n  .git               # Git source directory\n  assets/            # Uncompiled raw SCSS\n  bin/               # Command line scripts\n      install.php    # Database installation script\n  config/            # Database credentials, utility helpers, and other configuration\n  data/              # SQL database files\n  node_modules/      # Node.js front end dependencies\n  docker/            # Contains Docker environment variables\n  public/            # Publicly accessible files\n      css/           # Compiled, ready-to-use styles\n      js/            # Compiled, ready-to-use scripts\n      index.php      # Main entry point for the entire application\n  src/               # PHP source code\n      app            # Router code\n      controllers/   # Controller classes\n      models/        # Model classes\n      views/         # Views\n  tests/             # Unit tests\n  vendor/            # Composer files and 3rd party packages\n  .gitignore         # Files to be ignored in the repository\n  composer.json      # Composer dependency file\n  composer.lock      # Composer lockfile\n  docker-compose.yml # Docker configuration\n  Dockerfile         # Docker configuration\n  LICENSE            # MIT License file\n  Makefile           # Docker instructions\n  package.json       # npm dependency file\n  package-lock.json  # Dependency lockfile\n  README.md          # Brief documentation\n```\n\n## Usage\n\nLaconia is a simple list-making website. You can register an account, log in, log out, reset your password, create and edit lists, and view public profiles.\n\n- `/` - Landing page\n- `/register` - Register a new user\n- `/login` - Log in to user account\n- `/dashboard` - Logged in dashboard screen\n- `/logout` - Log out of user session\n- `/forgot-password` - Get a password reset link\n- `/create-password` - Create a new password\n- `/users` - View all users\n- `/settings` - Edit user settings\n- `/lists` - View lists\n- `/create` - Create a new list\n- `/edit/:list_id` - Edit an existing list\n- `/:username` - View public profile\n- `/404` - Any not found redirects to 404.\n\n## Testing\n\nLaconia uses PHPUnit for unit testing. Tests will go in the `/tests` directory. For now, here is how to run a Hello, World! script.\n\n```bash\n./vendor/bin/phpunit ./tests/HelloWorldTest\n```\n\n## Motivation\n\nLaconia is a personal project created by Tania Rascia to learn the fundamentals of programming and modern web development from scratch. The main goals of the project are to learn MVC (Model View Controller) architecture, the OOP (Object-Oriented Programming) paradigm, routing, authentication, security, modern development practices, and how to tie it all together to make a functional web app.\n\nLaconia runs on PHP 7.2 and MySQL. It uses Composer to autoload classes, configuration and utility files, as well as future tests through PHPUnit. Node.js is used to compile Sass to CSS via npm scripts. The CSS framework [Primitive](https://taniarascia.github.io/primitive) was used for the design.\n\nHere are some of the concepts I learned while writing this program:\n\n- **Authentication** – logging in, logging out, resetting a password, having private content/dashboard hidden from anonymous users\n- **Security and validation** – encrypted passwords and hashing, parameter binding with SQL, making sure users cannot be overridden, making sure no spam or empty content can go through, making sure passwords and usernames have the proper characters\n- **Routing** – Redirecting to URLs based on incoming request method and URI path, creating public user profiles in the root directory, creating dynamic pages based on GET requests\n- **Object-oriented programming** – I had never used a class in a working application before writing this app, so I learned a lot about constructors, inheritance, and abstract classes\n- **Composer** – I had no prior experience using Composer, so I wanted to find out why it was the standard in modern PHP development. I used it for autoloading classes and configuration.\n- **Database schema** – how to structure a database to relate information easily between the tables, i.e. linking lists and list items, users and user comments, etc.\n  Sessions and Users – how to easily deal with sessions, users, and authentication.\n\n## Acknowledgements\n\nI've used a combination of many tutorials and StackOverflow posts to create this project. These have been the most important.\n\n- [How to reset user password](http://thisinterestsme.com/php-reset-password-form/)\n- [How to create a user login](http://thisinterestsme.com/php-user-registration-form/)\n- [How to make a PDO class](https://www.culttt.com/2012/10/01/roll-your-own-pdo-php-class/)\n- [How to validate passwords](https://stackoverflow.com/questions/22544250/php-password-validation/22544286)\n- [General structure of a PHP application](https://ilovephp.jondh.me.uk/en/tutorial/make-your-own-blog)\n- [Directory structure example](https://php.earth/docs/faq/misc/structure)\n- [Promisify XHR](https://stackoverflow.com/questions/30008114/how-do-i-promisify-native-xhr)\n- [MVC concepts and routing class](https://github.com/laracasts/The-PHP-Practitioner-Full-Source-Code/)\n\n## Contributing\n\nPlease feel free to fork, comment, critique, or submit a pull request.\n\n## Author\n\n- [Tania Rascia](https://www.taniarascia.com)\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaniarascia%2Flaconia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaniarascia%2Flaconia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaniarascia%2Flaconia/lists"}