Download the PHP package 4apps/staticphp without Composer

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

apidocs packagist

StaticPHP

Simple, modular php framework. README.md needs to be updated.

Requirements

Installation

There are two ways to start using StaticPHP framework:

  1. Docker <- Suggested one
  2. Composer

1. Using Docker

  1. docker compose build develop
  2. docker compose up -d --remove-orphans develop
  3. Open in vscode using Remote containers

2. Using composer

Run composer create-project 4apps/staticphp ./ for stable version and composer create-project 4apps/staticphp ./ master-dev for latest development version from github. Composer will install all the dependecies for you.

How to install composer?

Npm for SCSS and Javascript

Install node and npm run npm install

How to install node?

* Remember to set correct permissions for Cache directory. For example: chown www-data:www-data ./src/Application/Cache/ or chmod 777 ./src/Application/Cache/

Most quickest way to run your project is to use php's in-built server. To do that, cd into the ./somedir/src/Application/Public and run php -S 0.0.0.0:8081. Now open your server_ip:8081 (or 127.0.0.1:8081) and StaticPHP first page should show up.

or

run npm start

By default, running StaticPHP with php's cli server, turns debugging on, but you can configure that in ./somedir/Applications/Config/Config.php by setting $config['environment'] or $config['debug'] variables.

* Take a look at home controller in ./somedir/src/Application/Modules/Controllers/Welcome.php and views in ./somedir/src/Application/Modules/Views/ for basic framework usage.

Assets

All assets are stored in ./somedir/src/Application/Public/assets/ directory. StaticPHP uses npm to handle css (using SCSS) and js assets, but you can also do it manually.

Cron

Running controller from command line can be done this way: php -f /srv/sites/gm.lv/sla/src/Application/Public/index.php -- --query /defaults/console/refresh

Api

Api documentation*

* Work in progress

Example app

A simple todo application based on sessions. To view the source, checkout the "example" branch.

PHPUnit

To run phpunit tests, install composer dev dependecies (composer install --dev) and then run ./Vendor/bin/phpunit ./src/Application/

ApiGen api documentation

To generate api documentation, install composer dev dependecies (composer install --dev), run ./Vendor/bin/apigen generate ./ --destination ./src/Application/Public/docs ./src or npm run docs and open http://127.0.0.1:8081/docs/

Basic Nginx configuration

server {
    listen       80;
    listen       443 ssl;
    server_name  staticphp.gm.lv;

    root  /www/sites/gm.lv/staticphp/src/Application/Public;
    index index.php index.html index.htm;

    # Error responses
    error_page 403 /errors/E403.html;
    error_page 404 405 =404 /errors/E404.html;
    error_page 500 501 502 503 504 =500 /errors/E500.html;

    # Handle error responses
    location ~ /errors/(E[0-9]*.html) {
        alias /www/sites/gm.lv/staticphp/System/Modules/Core/Views/Errors/$1;
    }

    # Base location
    location / {
        if (!-e $request_filename)
        {
            rewrite  ^(.*)$  /index.php?/$1  last;
        }
    }

    # Allow font origin (for webfonts and similar)
    location ~* \.(eot|ttf|woff|svg)$ {
        add_header Access-Control-Allow-Origin *;
    }

    # Set assets expiration headers to max
    location ~ ^/assets/ {
        expires max;
    }

    # Handle php files
    location ~ \.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }

        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        include /etc/nginx/fastcgi_params;

        # To intercept errors from fastcgi and show our error pages instead, otherwise nginx will send to browser whatever response there was from fastcgi
        fastcgi_intercept_errors on;
    }

    # Show 404 for hidden files
    location ~ /\. {
        return 404;
    }
}

TODO and ideas

History

v1.2.0

v1.2.0

v1.1.0

v1.0.0

v0.9.5

v0.9.4

v0.9.3

v0.9.2

v0.9.1

v0.9

v0.8


All versions of staticphp with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
twig/twig 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 4apps/staticphp contains the following files

Loading the files please wait ....