Stars: 110
Forks: 26
Pull Requests: 18
Issues: 8
Watchers: 19
Last Updated: 2022-07-22 19:37:51
PHP7 Fat-Free Framework (http://fatfreeframework.com) example - A skeleton i18n web application which implements an MVC structure ( https://github.com/vijinho/FFMVC ) and includes the files from the https://getbootstrap.com project.
License: Other
Languages: PHP, HTML, CSS, JavaScript
Use the branch skeleton-nodb-nobs for a skeleton setup with no database features enabled (commented-out), no bootstrap files and empty .md files.
Skeleton PHP7 Fatfree-framework MVC website codebase.
Project Goal: Be a good and extremely flexible starting-point for implementing any kind of PHP project in F3.
## Usage
app/config/default.ini
and config.example.ini
files to suit
your project - create your local setup config.ini
file from this.app/lib/App
and the associated routes in app/config/routes-*.ini
to suit.composer dump
to update your the autoloader with your newly created classesPHP7 only now! - see CHANGELOG.md
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:8080app/config/config.example.ini
to config.ini
app/config/config.ini
and add anything extra from default.ini
for overridesrun composer install
### Database
data/db/sql/create.sql
(set ini option for db.create=true)Setup empty website folders as follows:
mkdir -p tmp/cache tmp/sessions tmp/uploads tmp/logs data
sudo chown -fR www-data:www-data tmp data
sudo chmod -fR 777 tmp data
Note: The files that were in lib/FFMVC
have now been split-out into their own repository https://github.com/vijinho/FFMVC
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/App/App.php
- start fatfree project by including this file and executing Run();lib/
- all external library files/classesapp/lib
- local application-specific librariesapp/lib/App/Controllers
- MVC Controllersapp/lib/App/Controllers/API
- MVC Rest API Controllersapp/lib/App/CLI
- Controllers for when executing in a command-line environemnttmp/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 pagetests
- unit tests see docs/TESTING.mdUsed for bootstrapping the application and generic enough to be separate from the main project.
lib/FFMVC/App.php
- Base Application Class to start/shutdown applib/FFMVC/App/Helpers
- Auxillary helper functions and utility libraries specific to the projectTest certificates in app/config/webserver/ssl/ Use 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-boilerplate.local" -keyout f3-boilerplate.key -out f3-boilerplate.crt
Add to apache virtual host (and also see the f3-boilerplate-ssl.local files in app/config/webserver/
SSLCertificateFile ssl/f3-boilerplate.crt
SSLCertificateKeyFile ssl/f3-boilerplate.key
MAMP lets you add the SSL file in the Hosts/SSL tab.
From the base folder run:
php app/lib/App/CLI.php /
The output will be:
CLI Script
FFCMS\CLI\Index::index
Hello World!
Finished.
Script executed in 0.048 seconds.
Memory used 2.29 MB.