Download the PHP package shinidev/sapling without Composer

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

Sapling

A small PHP framework that implements MVC design pattern. This framework is created with the intent to give the author knowledge about php and at the same time be usable for the community.

Installation

composer create-project shinidev/sapling directory

Configuration

.envtemplate

You can edit the .envtemplate file to correspond to your database configuration, after editing it create a copy and name it .env. It is what Sapling reads for your database configurations. You should not include your .env file when uploading your repository to github.

config/Debug.php

In here you can enable Sapling's error reporting. Sapling's error reporting is on by default. DEVELOPMENT, when true displays error. STRICT, when true kills the application if there are errors. Note, that this is seperate from php error reporting, if you want to enable php error reporting go to your .env file and set DEVELOPMENT to "TRUE".

config/Routes.php

In here you can set your base url, default controller, default function and error page directory.

Usage

src/App/Controller

This is where you're gonna load your models and views.

Loading a Model

$this->loadModel('modelFile', 'optionalname')

Using a loaded model

$this->ModelFile->function() or $this->OptionalName->function()

Loading a view

$this->loadView('viewFile', 'optionalData')

src/App/Model

This is where you're going to communicate to your database. Model classes is recommended to extend the QueryBuilder class.

Example Insert Query

    $this->table('tablename'); // sets the table to insert data to 
    $this->insert(['columns'], ['datas']); // tells what columns and corresponding data
    // Insert only needs a table name

Example Select Query

    $this->table('tablename'); // sets the table to get data from
    $this->whereMany(['columns'], ['values']); // Sets the where clause based on the given columns and values
    // or
    $this->whereSpecific('column', value, '!='); // Appends and sets the specific column and its value one by one.
    // or
    $this->whereManual("WHERE column = ?", [values]); // Set the where clause manually.
    $this->join('left', 'tablename', 'on condition'); // Joins tables
    $this->order('column'); // Order by column
    $this->limit(100); // Limits result
    $this->select(['columns']); // Selects columns
    // Select only needs a table, all the others are optional

Example Update Query

    $this->table('tablename'); // sets the table to get data from
    $this->whereMany(['columns'], ['values']); // Sets the where clause based on the given columns and values
    // or
    $this->whereSpecific('column', value, '!='); // Appends and sets the specific column and its value one by one.
    // or
    $this->whereManual("WHERE column = ?", [values]); // Set the where clause manually. 
    // It is necessary to have always setted the where clause or else Sapling will display error
    $this->update(['columns'], [values]);

Example Delete Query

    $this->table('tablename'); // sets the table to get data from
    $this->whereMany(['columns'], ['values']); // Sets the where clause based on the given columns and values
    // or
    $this->whereSpecific('column', value, '!='); // Appends and sets the specific column and its value one by one.
    // or
    $this->whereManual("WHERE column = ?", [values]); // Set the where clause manually. 
    // It is necessary to have always setted the where clause or else Sapling will display error
    $this->delete();
    // Deletes rows based on the where clause that is setted.

Getting the builded query

    $this->getLastQuery(); // returns a string

Url Helper

Getting the base url

Url::baseUrl();

Redirecting

Url::redirect(url);

Passing parameters to controller

  http://localhost/Sapling/controller/method/param1/param2/param3
  // The url above passes 3 parameters to a controller function.
  public function test(param1, param2, param3); // Your controller method

Loading resources

Loading a css file in a view php

href="resources/css/test.css"

Loading a js file in a view php

'

Notes

Test.php controller and TestModel.php only exists to serve as an example on how to use a controller and a model in Sapling. Database are not needed as long as you don't load a model in your controller.

Current Features

  • Url Routing
  • Security against script access
  • Secured database credentials
  • Simple debugger
  • Flexible query builder
  • Simple folder structure
  • Easy to use and understand
  • Documented

Features to learn/add

  • Better routing implementation, similar to of Laravel or Codeigniter
  • API implementation

All versions of sapling with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
symfony/http-foundation Version ^5.3
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 shinidev/sapling contains the following files

Loading the files please wait ...