source code for my personal website
Still in the early stages of development, lots of silly little experiments, lots of structure changes. More info soon.
Based on the structure outlined by php-pds/skeleton_research.
The meat of the site is kept in the src/ directory divided into namespace directories under that. The public/ doesn't handle much right now, this may change in the future.
Autoloading / Object instantiation
Composer autoloading takes care of basic namespace and class functionality. Provide a use 'Namespace/Class'; statement at the top of the file and instantiate a class as you would expect. Per PSR-4 standard.
Due to the fact that the /src/Http/Post.php class allows the client to dynamically instantiate and run functions via ajax, a more explicit spl autoload function is used as fall back (in App->autoload() function). The function will require_once any class given the correct path rooted in src/, regardless of the location it's being called from... This may negate the need for Composer autoloading, still testing on the best course of action on this. Right now it makes more sense to leave class access as open as possible while the site's being developed.
Basic Routing Strategy
- .htaccess file redirects all traffic to public/index.php
- public/index.php instantiates a new App object
- Core/App() forces HTTPS, sets autoload, sets database, sets view and routes the request via Http/Router
- Http/Router() routes by taking the server request type (Get or Post) and dynamically instantiates an appropriate object.
- Http/Get gathers all url elements and query parameters, calls the App's View object, authorizes the request, and includes the appropriate View php file.
- View/index.php uses the View/ViewBase() object to render the view.
- Http/Post accepts ajax calls from the View script, using explicit commands that map directly to Classes and Functions in src/ and returns JSON directly from those Classes/Objects. A whitelist of approved functions can be provided the Post algorithm to restrict code base access to the clients for better security.
Goals behind routing strategy
My goal with this minimalist framework is to explore ways to cut down on development time, given the ability to call PHP directly from the JS using ajax calls through this implicit routing. Although a whitelist of available classes and functions can certainly be made in Post if needed. For now, I'm leaving it open while I build the site.
Development Progress and Goals
Through tracking projects, milestones, and issues on the public repo @ github.com/wforbes/wforbes.net I intend to roll out feature sets that slowly evolve the website and it's underlying framework.
The first milestone was building a Basic User Account Experience that allowed anyone to sign up for a user account, log in, and access a few pages.
The second milestone is now to build a New expanded sitemap and role/access format to better refine how the site works. All users will get a set of pages located at wforbes.net/username where they can create content like a profile, blog and portfolio page; which leaves the base set of urls like wforbes.net/blog to relate to the site owner's blog. This requires differentiating user accounts with Roles, and deciding how pages react to those roles with a set of permissions. This milestone will include:
- User Profile - Display a profile of information about yourself, including custom fields and style formatting.
- User Blog - Write blogs and share them on a blog page, like a blogger.com / simple Wordpress clone. Using CKEditor or TinyMCE WYSIWYG editor... ( still deciding what to use )
- User File Storage - Upload and save media like pictures, video, and most other types of files on the site (within reason).
- Visitor Tracking - Give the site owner and users insight into who is viewing their content and how often.
- User History - Keep track of your actions and data changes while using the web site. Providing unique ways to return to previous states of the app, roll back changes to your data and offering detailed summaries of what the heck you did when.
Future Project/Milestone Goals
I will use the prototypes I've developed between 2015 - 2019 to implement some interesting site features that I've been looking for in a website; some of these include (in no particular order):
- User CMS / Sites - Give the user a full set of tools to build their own website within this website, complete with CMS (content management system, like wordpress), and a simple in browser Code Editor (using ACE). Test your site on this site, then export your files to use on your own hosting.
- User Messaging System - Send messages to other users on this site, via email to email addresses, or to social media sites like Facebook.
- Dynamic Evolving View - (Per prototype: wforbes.rf.gd ) Full screen page sections can be added to the page, scrolled to and locked into place using the nav bar links. Once locked, their individual content can be scrolled and worked within. Each section is a unique entity on the app, keeping it's own history, able to be navigated through forward and back buttons, and closed. Once closed it is removed from the page.. but that section's session can be persisted for later use. Use each section to operate on a different part of the site without having to open new browser tabs. The goal here is to explore new types of workflows on a single page which would normally require moving between seperate pages / browser tabs
- Browser History - Using a third party tool called BrowserHistoryView organize, analyze, and make sense of your browsing. Compile useful information you've gathered while researching or working; save it all in an easily readable and accessible format, save and organize the medias that your history items link to into sharable or workable data sets. I found that this was incredibly useful while doing research and compiling information. Although the BrowserHistoryView app doesn't make navigating through your history easy - I'd like to experiment with ways to improve upon it and produce a more useful tool.
- Scroll History - Using a browser add-on similar to the now defunct Data Selfie, gather your facebook data while scrolling through it on PC. Keep items you've seen and organize them, get a better idea of what you actually get served on facebook and use it to find new content.
- User Social Media Analytics - Give the user the tools to pull available data from their social media accounts and provide useful ways to analyze it, store it, add to it, or delete it from the sites. Like an all in one dashboard that lets you access multiple social media accounts at once.