Download the PHP package rougin/basilisk without Composer

On this page you can find all versions of the php package rougin/basilisk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package basilisk

Basilisk

Latest Version on Packagist Software License Build Status Coverage Status Total Downloads

Basilisk is a project skeleton specifically for the Slytherin PHP micro-framework which contains an opinionated code structure based on my experiences creating projects using Slytherin as its foundation. The code structure should be easy to understand and be under SOLID principles.

Installation

Create a new Basilisk project via Composer:

Once created, kindly execute the one-time setup to the project:

Running the project

To run Basilisk in a web browser, the PHP's built-in web server can be used:

After running, open a web browser then proceed to http://localhost in a new tab.

[!WARNING] This command should only be used for development purposes. It is recommended to use Apache or Nginx in running this project.

What's inside?

A Basilisk project contains a configuration of the following packages:

Slytherin

Slytherin is a simple and extensible PHP micro-framework that tries to achieve a SOLID-based design for creating web applications. As Slytherin is the core foundation of Basilisk, the following packages of Slytherin has already been configured out of the box:

[!NOTE] Kindly see the Slytherin's documentation on how to use the above-mentioned packages.

Dotenv

Dotenv is a simple PHP package that loads environment variables from .env files to getenv(), $_ENV and $_SERVER automagically. This is one of the core packages of Basilisk as it uses environment variables in most of its configuration in the app/config directory:

Phinx

Phinx is a tool made for PHP in performing database migrations. Being a framework-agnostic package, Phinx can create, write and perform database migrations easily. To use this package, kindly install it first using Composer:

Once installed, kindly check the app/config/phinx.php file on the variables that requires an update:

When creating or performing database migrations using Phinx, always use the configuration file provided by Basilisk:

Weasley

Weasley is a utility package in PHP that provides generators, helpers, and utilities for Slytherin. The following packages are also configured within Basilisk:

Directory structure

The following directory names below are only the preferred names based on my experience building projects using Slytherin. However, they can be easily be extended or removed as Slytherin not does not conform to any of the specified preferences:

Checks

This directory contains PHP classes that are used specifically for validation. The said PHP classes may be extended to the Check class of Weasley:

[!NOTE] For more information on how to create a validation class, please see the Validation section of the Weasley documentation.

Depots

This is the main directory that should contain the business logic of Basilisk:

Prior in using depots, I implemented most of the logic in the Routes or Models directories. However, it presents a challenge to me in organizing code when implementing new features. In using depots, I can reuse the same logic in to either Routes (for receiving user request) or in Scripts directory (for handling terminal-based actions).

[!NOTE] In other PHP frameworks and other guides, Depot is also known as the Repository pattern.

Models

This is the directory where for storing the models (if using Eloquent) or entities (if using Doctrine). In my experience, my best practice is that the class names added in this directory should represent a database table (e.g., if having a users table from the database, it should be represented in Basilisk as User class):

[!NOTE] As Basilisk provided a User model based on Eloquent, kindly see its official discussion for its usage and configuration.

Phinx

This is the directory for the storage of related files to the Phinx package. The Scripts directory must contain the generated database migrations while the Seeders directory must contain the custom database seeders:

This directory will also be used for performing database migrations and its seeders. To perform a database migration, kindly run the migrate command:

The seed:run command can be used for populating data in a database:

When executed, the command above will perform the database seeders in alphabetical order.

[!NOTE] Before performing any database migrations from Phinx, kindly update the database credentials first in .env:

Routes

This is the gateway of Basilisk wherein the HTTP routes are stored and configured as a PHP class. The PHP class can call or instantiate the classes found from the previously mentioned directories:

Once a HTTP route was created to the directory, it should be added to the Router for it to be recognized by Slytherin:

[!NOTE] In other PHP frameworks, Routes is commonly known as Controllers.

Scripts

This is the directory to store commands or scripts. These scripts can be executed directly using the php command in the terminal:

Development workflow

Basilisk also provides unit testing and static code analysis out of the box when implementing new features to minimize the introduction of errors during development. It also has an opinionated coding style which can be configured after the installation.

Unit testing

The sample unit tests provided in Basilisk were written in PHPUnit:

It is recommended to run the above command to always check if the updated code introduces errors when creating fixes or implementing new features.

[!NOTE] Please see the official documentation of PHPUnit on how to write unit tests to the specified testing framework.

Code quality

To retain the code quality of Basilisk, a static code analysis code tool named PHPStan can be used during development. To start, kindly install the specified package in the global environment of Composer:

Once installed, PHPStan can now be run using its namesake command:

[!NOTE] When running phpstan, it will use the phpstan.neon file which is already provided by Basilisk.

Coding style

Aside from code quality, Basilisk also uses a tool named PHP Coding Standards Fixer for maintaining an opinionated style guide. To use this tooling, it needs also to be installed in the Composer's global environment first:

After its installation, kindly use the php-cs-fixer command in the same Authsum directory:

The phpstyle.php file provided by Basilisk currently follows the PSR-12 standard as its baseline for the coding style and uses Allman as its indentation style.

[!NOTE] Installing both PHPStan and PHP Coding Standards Fixer requires a minimum version of PHP at least 7.4.

Changelog

Please see CHANGELOG for more information what has changed recently.

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of basilisk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
rougin/weasley Version ~0.6
vlucas/phpdotenv Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rougin/basilisk contains the following files

Loading the files please wait ....