PHP7 Fat-Free Framework https://fatfreeframework.com based CMS extending original https://github.com/vijinho/f3-boilerplate project and using UI-kit http://materializecss.com/
OTHER License
Consider this a work-in-progress and an 'alpha' release. Contributions are welcome!
Skeleton PHP 7 Fatfree-framework MVC CMS website codebase based on the simpler example project f3-boilerplate.
Project Goal: Be a good and extremely flexible starting-point for implementing any kind of CMS project in F3.
app/config/default.ini
and config.example.ini
files to suit your project.app/lib/FFCMS
and the routes in app/config/routes-*.ini
to suit your files.I wrote this project for myself, but if you are thinking to use it, thinking on the points below will help you decide.
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin -filename=composer
composer update
php -S http://127.0.0.1:8080
and browse to http://127.0.0.1:8080
data/phinx.yml
with database settings for database configuration and migrationsapp/config/config.example.ini
to config.ini
app/config/config.ini
and add anything extra from default.ini
for overridesrun composer install
Setup empty website folders permissions on the command-line as follows:
mkdir -p tmp/cache tmp/sessions tmp/uploads tmp/logs
find tmp -type d -exec chmod go+rwx {} \;
File ownership should be as follows:
sudo chown -fR www-data:www-data tmp data
There are 3 methods to create the database, by default it is automatically created. See docs/DATABASE.md for full details of database schema.
Import the sample empty database dump file data/db/create.mysql into an empty database directly.
####Automatic method
If the config has db.create
set to true the file www/index.php
or app\lib\FFCMS\CLI.php
will attempt to list tables when booting the app and cache them for 10 minutes, if they don't exist, it will execute `app/lib/Functions/Setup::database' to:
email.from
as the email address with 'admin' as the passwordLogin and change the settings for this user ASAP!
####Migration method
For database migrations using phinx - read the documentation
cd data
./phinx migrate
Note: On a previously created database using the manual/automatic methods above, import the SQL dump data/db/sql/phinx.sql
and then create new migrations.
Use faker to seed the database. Phinx has integration for this.
cd app/data
php phinx seed:run
With phinx the following packages are installed, which might be too heavy, so it can be removed if you don't care about migrations:
I recommend using Let's Encrypt to generate a real live valid SSL certificate for production environments.
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=GB/ST=STATE/L=TOWN/O=Office/CN=f3-cms.local" -keyout f3-cms.local.key -out f3-cms-local.crt
Add to apache virtual host (and also see the f3-cms-ssl.local files in app/config/webserver/
SSLCertificateFile ssl/f3-cms.local.crt
SSLCertificateKeyFile ssl/f3-cms.local.key
MAMP lets you add the SSL file in the Hosts/SSL tab.
Note: The files that were in app/lib/FFCMS
have now been split-out into their own repository https://github.com/vijinho/FFCMS
They can then be included in your own project by adding the same lines in your composer.json
as used in mine here.
lib/bcosca/fatfree-core
- fatfree framework (core) lives herewww
- website and public doc root (aka public_html
or htdocs
etc)www/index.php
- start website application here - is the default file used by .htaccess
for routingapp
- the website application lives outside the webroot for securityapp/lib/FFCMS/App.php
- start fatfree project by including this file and executing Run();lib/
- all external library files/classesapp/lib
- local application-specific librariestmp/cache
tmp/sessions
tmp/uploads
- temporary filestmp/logs
- application logfilesdata
- website data storage folderdocs
- application documentation (markdown files)app/config
- application configuration filesapp/config/vhost
- application virtual host configuration files (apache and nginx supported)bin/cli.php
- symlink to command-line runner in app/lib/App/CLI.php' which uses routes in
app/config/routes-cli.ini`app/en/templates/error/
- these files are standard php includes, not f3 templates, used by the error handler functionapp/en/templates/error/debug.phtml
- debug error page (if DEBUG=3)app/en/templates/error/404.phtml
- 'friendly' file not found pageapp/en/templates/error/error.phtml
- 'friendly' error pageapp/lib/FFCMS/App
- Base Application Classesapp/lib/FFCMS/Models
- MVC Modelsapp/lib/FFCMS/Controllers
- MVC Controllersapp/lib/FFCMS/Controllers/Api
- MVC Rest API Controllersapp/lib/FFCMS/Helpers
- Auxillary helper functions and utility libraries specific to the projectapp/lib/FFCMS/Traits
- Shared class traitsapp/lib/FFCMS/CLI
- Controllers for when executing in a command-line environemntUsed for bootstrapping the application and generic enough to be separate from the main project.
lib/vijinho/ffmvc
- Base Application Class to start/shutdown app and helpers see ffmvc on github
lib/vijinho/enums
- Enum-handling class see php7-enums on github