Download the PHP package groucho75/phmisk without Composer

On this page you can find all versions of the php package groucho75/phmisk. 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 phmisk

phmisk

Phmisk (/piː eɪtʃ miːsk/ or /f miːsk/ or /wɑtˈevər/ or /wɒt ðə fʌk/) is a Php/Html5 MIcro Starter Kit. Phmisk is ready to work with:

(1) Phmisk comes out without these libraries, so you have to use Composer to install them. Of course, using Composer you can include and use also other libraries.

You can see the Wiki to find some tutorials and guides.


Getting started

Prerequisites

You need Composer installed on your machine.

Installation method #1 (Github):

  1. download and unzip this repository
  2. enter the phmisk-master folder and launch Composer install to resolve and download required packages:

Installation method #2 (Packagist):

  1. open the terminal and go to your web server
  2. launch the following command:

  3. you will find the new ready-to-use my_project folder in your web server: it contains all files including the dependencies downloaded by Composer

Start editing:


$ph4

You can write your application editing the app/routes.php.

You can use a Phmisk object called $ph4 that contains the instances of main libraries. In this page you can read about how to use these libraries.

You are right, $ph4 means 'ph' plus 4 characters ('misk').


Routes

Routing

Add the simplest route in main app/routes.php:

And you can visit your-site.com/hello to see it.

Custom controllers

You can map custom controller/method as a route: put your controllers inside app/controllers and they will be autoloded. Then, you have to add a route statement in app/routes.php: here is a route provided by custom controller called Demo:

The Demo controller file is located in app\controllers\Demo.php and contains something like:

The Base controller is a parent class you can extend to have shared methods.

Note: if you have add a new controller file, you need to run a command to update Composer map autoload:

Reference

For usage and more examples (Dynamic Route Patterns, Mounting Routes...) please see the router homepage: bramus/router.


Template (views)

Phmisk has a simple template engine to show view files. To use the template engine in a route you have to add use ($ph4) to the function and you can use it as $ph4->view.

A route in app/routes.php could be:

The template file, ui/hello.php, could be:

You can visit your-site.com/hello/johnny to see it.

Note that template files are php files, so you can freely use php statements. The php template files usually are into the public ui folder, together with the assets (js, css, images): you can move template files in another folder (e.g. app/views) setting an optional VIEWS_PATH constant in index.php.

Reference

In routes you have to use 2 functions:

The template engine uses php files as views.

In view files you can simply print the variables as in php:

In view files you can include other view files using standard php, e.g.:

For more info please browse the View class.


Database layer

Phmisk uses a simple database toolkit.

First of all, set the database connection settings in app/config.php.

In this blog route you get some posts and prepare them to be sent to layout:

Note that you have to add use ($ph4) to the function and then you can use it as $ph4->db. The database connection parameters are set in app/config.php and the connection starts in app/bootstrap.php.

Just for your thirst for knowledge, here is the blog template file, ui/blog.php:

Custom models

You can create your model classes: put your classes inside app/models and they will be autoloded. The provided database layer Sparrow can use custom classes to work with objects.

Note: if you have add a new model file, you need to run a command to update Composer map autoload:

Reference

For usage and more examples please see the database layer home: Sparrow.


Sessions

Phmisk comes with a simple wrapper for php session management. It helps to start and destroy session, set and delete session vars. It helps to use "flash" vars: session data that live only in next round (e.g. feedbacks and messages to user).

Reference

For more info please browse the Session class.


The file structure

The app/controllers folder contains all your custom controllers and a Base controller. The app/core folder contains some important bundled libraries (e.g. the core Phmisk class). The app/classes folder contains optional classes: of course you can add here your custom classes, made by you or simply not available on remote repositories, and they will be autoloaded. The app/models folder contains all your custom model classes. It could be a good idea move the app folder outside/above the site foot.

The ui contains all the Html5boilerplate and Twitter Bootstrap folder and files, generated using Initializr and edited to work in Phmisk. Then, there are some php view files: header, home, footer...

Phmisk comes out without libraries (router, template, ORM). You have to use Composer to install them. After that a new app/vendor folder will appear.

The app folder contains some important files:


Advanced setup

Set constants

In index.php you can edit some important constants:

Secure the app folder

For security reasons it could be a good idea move the app folder (app) outside/above the web root.

In this sample setup the app folder has been moved one level above the web root:

Include more packages

Php packages

To include more php packages from Packagist (the main Composer repository) you can simply add them in require section inside composer.json and then launch Composer update:

Then, in main app/routes.php you can start using it writing:

If you like to use other packages instead of standard (e.g. another template engine), you have to set them in require section inside composer.json, then change the initialisation in app/bootstrap.php.

You can install libraries via Composer not only from Packagist, but e.g also from Github: here is an example.

Javascript libraries

If you need javascript libraries, of course you can get them via Composer, or you can download them and put in ui folder, or simply link their CDN from template files.

Tutorials & Samples

Please see the Wiki to find some tutorials about adding new packages.


Deploy to production

When you are ready to deploy your phmisk site to production server, follow these steps:

  1. of course, copy all the files on production server;
  2. in index.php set ENV to live;
  3. run the following command on production server (--optimize-autoloader flag = faster Composer autoload; --no-dev flag = development packages will be not installed):

Note: be sure to upload also the composer.lock file and only run Composer install on the production server: in this way the development packages will be skipped and you will be sure that the version of the packages installed on the production server match those you developped on. For this reason, never run Composer update on your production server.

If you cannot access the production server via shell, you can run the command (step 3) on local server, then upload all the files on production server.


Donations are welcome

If you like my hard work, of course you can donate some money to me.

And don't forget to donate something also to the authors of other libraries used by Phmisk (see above for repo and links).


All versions of phmisk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
bramus/router Version dev-master
unlight/sparrow Version dev-master
erusev/parsedown Version dev-master
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 groucho75/phmisk contains the following files

Loading the files please wait ....