Download the PHP package adil-jaafar/picophp without Composer

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

picoPHP - Your Lightweight and Flexible PHP Framework

picoPHP is a minimalistic yet powerful PHP framework designed for rapid development and ease of use. It leverages file-based routing, dependency injection, and middleware to provide a clean and organized structure for your web applications.

Key Features

Getting Started

  1. Installation: Use Composer to install picoPHP.

  2. Directory Structure: Organize your application code within the app directory.

  3. Routing with routes.php: Create routes.php files to define your routes.

    This example defines a GET and POST route for /foo/bar.

  4. Accessing Services: picoPHP automatically injects the required services into your route handlers.

  5. Path Parameters: Use Path service to access route parameters defined with square brackets in the directory structure.

    • /users/123/edit will map to the function in app/users/[id]/edit/routes.php and the parameter 'id' will equal 123.
    • /photo/path/to/my/image.jpg will map to the function in app/photo/[...chemin]/routes.php and the parameter 'chemin' will equal path/to/my/image.jpg.
  6. Directory Naming Convention Folders enclosed in parentheses () are intended for structural organization, e.g., app/users/(admin)/edit/[user_id]. They are used to map paths like /users/edit/123 to the route structure, where user_id captures the dynamic parameter.

  7. Middleware: Add middleware to middleware.php files in any directory within your application. Middleware allows you to execute code before and after route handlers.

    • $before: An array of functions to execute before the route handler.
      • If any $before middleware function returns a value (other than true or null), that value is considered the response, and the route handler is not executed.
      • Returning true (or nothing at all) from a $before middleware function allows the request to proceed to the route handler (and to other $before middleware further down in the application's folder structure)
      • If a $before middleware returns a Response object, processing stops, and the framework immediately returns this response. This is ideal for things like auth checks.
    • $after: An array of functions to execute after the route handler. $after middleware run in the reverse order from the $before middleware.

Middleware Execution Order:

  1. $before middleware functions are executed from the root directory down to the directory containing the routes.php file. If a before returns a value other than true, processing stops.
  2. The route handler function in routes.php is executed.
  3. $after middleware functions are executed from the directory containing the routes.php file up to the root directory.

Example: Authentication Middleware

Create a middleware.php file in your app directory to implement global authentication.


<?php

// app/middleware.php

$before = [
    function(Request $request, Response $response) {
        if (!isAuthenticated($request)) {
            return $response(401)->json(['error' => 'Unauthorized']);
        }
    }
];

function isAuthenticated(Request $request): bool {
  //TODO replace by a real auth check
  $token = $request->header("authorization");
  return $token === "Bearer mysecrettoken";
}

All versions of picophp with dependencies

PHP Build Version
Package Version
No informations.
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 adil-jaafar/picophp contains the following files

Loading the files please wait ....