Download the PHP package popphp/popcorn without Composer

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

Popcorn PHP Micro Framework

Build Status Coverage Status

Join the chat at https://popphp.slack.com Join the chat at https://discord.gg/TZjgT74U7E

RELEASE INFORMATION

Popcorn PHP REST-Based Micro Framework 4.1.1
Released October 16, 2023

Overview

Popcorn PHP Micro Framework is a REST-based micro framework. It is a small component that acts as a layer for Pop PHP to enforce the REST-based routing rules of a web application. It supports PHP 8.1+.

popcorn is a component of Pop PHP Framework.

Top

Install

Install popcorn using Composer.

composer require popphp/popcorn

Or, require it in your composer.json file

"require": {
    "popphp/popcorn" : "^4.1.1"
}

Top

Quickstart

In a simple index.php file, you can define the routes you want to allow in your application. In this example, closures are used as the controllers. The wildcard route * can serve as a "catch-all" to handle routes that are not found or not allowed.

The above example defines two GET routes and wildcard to handle failures.

We can define a POST route like in this example below:

If you attempted access that above URL via GET (or any method that wasn't POST), it would fail. If you access that URL via POST, but with the wrong token, it will return the Auth failed message as enforced by the application. Access the URL via POST with the correct token, and it will be successful.

Top

Advanced

In a more advanced example, we can take advantage of more of an MVC-style of wiring up an application using the core components of Pop PHP with Popcorn. Keeping it simple, let's look at a controller class MyApp\Controller\IndexController like this:

and two view scripts, index.phtml and error.phtml, respectively:

Then we can set the app like this:

The default parameter sets the controller as the default controller to handle routes that aren't found. Typically, there is a default action in the controller, such as an error method, to handle this.

Top

Custom Methods

If your web server allows the configuration of custom HTTP methods, Popcorn supports that and allows you to register custom HTTP methods with the application.

Then you can submit requests with your custom HTTP methods like this:

Top


All versions of popcorn with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
popphp/popphp Version ^4.2.9
popphp/pop-cookie Version ^4.0.1
popphp/pop-http Version ^5.1.0
popphp/pop-session Version ^4.0.0
popphp/pop-view Version ^4.0.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 popphp/popcorn contains the following files

Loading the files please wait ....