Download the PHP package boneframework/skeleton without Composer
On this page you can find all versions of the php package boneframework/skeleton. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download boneframework/skeleton
More information about boneframework/skeleton
Files in boneframework/skeleton
Package skeleton
Short Description Bone Framework
License MIT
Homepage https://github.com/boneframework
Informations about the package skeleton
bone framework
Be ye wantin a PHP framework peppered with local pirate lingo?
It be the most fearsome framework in the seven seas!
http://github.com/boneframework
features
- PSR-7 http messaging
- PSR-11 dependency injection container configuration
- PSR-15 middleware routing
- i18n translator
- Self contained package based architecture
- Built in optional Docker dev environment
- Extendable Command Line Interface
installation
via composer
We recommend using our Docker environment, however you can use your own setup, install via composer:
via docker
The Docker dev environment saves you from all the usual devops nonsense. Clone boneframework/lamp
, then replace
the code folder boneframework/skeleton
, then start it up.
Add 127.0.0.1 boneframework.docker
to your /etc/hosts
(or your custom domain).
To start the docker server environment:
Then browse to https://boneframework.docker
, and you will see the site running.
The development also has Mailhog running at http://boneframework.docker:8025
, so you can configure any dev emails to use
SMTP port 1025
and all outgoing mails will appear in the Mailhog outbox.
MariaDB is running, on host mariadb
(see docker-compose.yml
), and config/bone-db.php
).
To "SSH" into your server in order to run PHP commands like composer etc, type the following in a fresh terminal window.
To shut down your server, CTRL-C out, then type bin/stop
.
a quick introduction to bone framework
skeleton project files
There are a few folders and files in your project, here's a quick description:
- config (Configuration for your application)
- data (Files your project will use (translations, cache, uploads, etc))
- public (The usual index.php endpoint and front end assets like css and images and js)
- src (Your application packages live in here)
- tests (Because it's nice knowing your code works)
- vendor (Third party composer libs, don't edit, don't commit!)
bone framework application cycle
Upon launching Bone Framework (
public/index.php
), the application does a few things: - Starts a session
- Loads the config from the config folder (different folders for different environments can be used, or environment vars)
- Registers bone framework core packages
- Registers packages from the
config/packages.php
into the DI container - Adds any site wide middleware configured in
config/middleware.php
- Dispatches a Request, returns a Response
config
You can drop in any number of
.php
files into theconfig/
folder. Make sure they return an array with the config . You can override configuration based on environment varAPPLICATION_ENV
, so for instance if the environment was production it would load the additional config the production subdirectory.
There are several config files included, some are for optional bone packages and may be removed :
In your config files, you can add anything you want.
the package class
Packages are a key component in a Bone Framework application. You will see in the config/packages.php
which Packages are currently running on the framework. Take note that the order is important,
as packages may have a dependency which it needs defined from another package. Have a look inside
src/App/AppPackage.php
:
You will see two methods, which are implementations of RegistrationInterface
and RouterConfigInterface
.
See the league/route
docs on usage of the router. In the addToContainer()
method, you can create factories for
your controllers and other dependencies.
controllers
You will notice in the above App package that the factory for the controller returns Controller::init($controller, $c)
.
This is a convenient initialisation class that will setup a few things into your class. To make things real easy, here's
all you need to do for each component:
- View Engine (implement
Bone\View\ViewAwareInterface
and useBone\View\Traits\HasViewTrait
) - Translator (implement
Bone\I18n\I18nAwareInterface
and useBone\I18n\Traits\HasTranslatorTrait
) - Site Config (implement
Bone\Server\SiteConfigAwareInterface
and useBone\Server\Traits\HasSiteConfigTrait
) - Session (implement
Bone\Server\SessionAwareInterface
and useBone\Server\HasSessionTrait
) - Logger (implement
Bone\Log\LoggerAwareInterface
and useBone\Log\HasLoggerTrait
)
You can also choose to extend Bone\Controller\Controller
, which will give you a view, translator, and site config
immediately.
controller action methods
You can see the configured routes in the package class, and which controller class and method to call. Each action
method is essentially a PSR-15 Server Request Handler Interface https://www.php-fig.org/psr/psr-15/
. See
src/App/Controller/IndexController.php
for a basic example.
db
Set your default db credentials in the main config/bone-db.php, and any environment specific configs in a subdirectory
In your package class, you can gert the connection from the container using $c->get(PDO::class)
.
i18n
Bone supports translation into different locales. Translation files (gettext .po
and .mo
) should be placed in
data/translations
, under a subdirectory of the locale, eg data/translations/en_GB/en_GB.po
. You can set the default
locale and an array of supported locales.
To use the translator, you can simply call:To use the translator, you can simply call:
You can also set a supported locale into any URL, it will be stripped off the request and the locale set.
For example, if you have an endpooint /morte/info
, you can make it /nl_BE/more/info
or whatever, your route will
still resolve but now the locale will be the one you set. You can call $this->l()
in a view file, to generate this
first part of your url.
logs
Bone uses monolog/monolog, and logs can be found in data/logs. Currently we only support writing to files, but you can add as many channels as you like:
To use the logger in a controller:
recommended packages
Bone Framework has a variety of packages already extending the framework further. Give these a try!
delboy1978uk/bone-form
- Generate forms, handle errors, i18n compatibledelboy1978uk/bone-doctrine
- A Doctrine Entity Mangerdelboy1978uk/bone-mail
- Mail functionality for Bone Frameworkdelboy1978uk/bone-user
- Full user registration system including activation emails etcdelboy1978uk/generator
- Generate new package templates quicklydelboy1978uk/bone-oauth2
- OAuth2 Authorization and Resource Serverdelboy1978uk/bone-open-api
- Open API Swagger documentationdelboy1978uk/image
- An easy image class based ongd
get swashbucklin'! gaarrrrr!
All versions of skeleton with dependencies
ext-fileinfo Version *
ext-intl Version *
ext-json Version *
ext-pdo Version *
boneframework/bone Version ^3.11
delboy1978uk/cdn Version ^2.0
delboy1978uk/image Version ^2.1