Download the PHP package comfyphp/core without Composer

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

Write PHP comfortably with ComfyPHP

Provide an better development environment for developers who targeting specialized environments, such as Internet Explorer or environments where JavaScript is disabled.

Framework Directory Structure

Before Using it

Required dependencies for ComfyPHP:

Download / Install

To use this framework, you can install it with Composer.

Basic public/index.php format

You can create index.php inside the public folder like the example provided below:

Or just add the fileBasedRouter() function into the index.php for File-Based Routing which will be introduced later.

Basic src/pages/_document.php Format

Both <!--%head%--> and <!--%body%--> will work as a regex to be replaced by <head>...</head> and <body>...</body> from each page, please do not delete it when editing the document.

Basic src/pages/page.php Format

Inside each webpage, there are two sections: <head>...</head> and <body>...</body>. You can customize the content in both the head and body of each page by making edits. However, if both the <head>...</head> and <body>...</body> sections are missing from the file, ComfyPHP will recognize it as an API controller and provide all the results captured from it.

Config composer.json

You can config composer.json to run ComfyPHP scripts.

or just run the command manually:

Development Mode

Start the application with development env:

Build for Production

To build the env for production server:

Then you can use apache/nginx to take care of the server.

Production Mode Preview

Start the application with production env:

Server Port

Server will run in http://localhost:3000 by default, you can add the port parameter to the script in order to set up the server port:

Routing

There are two methods available for routing: function-based routing and file-based routing. You have the freedom to choose either method based on your preference.

Function-Based Routing

When utilizing Function Based Routing, ComfyPHP will automatically search for a PHP file in /src/pages that matches the name mentioned in /public/index.php. By default, if you enter get("/alphabet", "abc");, it will look for /src/pages/abc.php. If you haven't created a file with the same name, it will return no results. Additionally, you can use methods other than get, such as post, put, patch, delete, head, options, trace and connect.

File-Based Routing

To implement File Based Routing, simply include fileBasedRouter(); in /public/index.php. This enables ComfyPHP to search within the /src/pages directory when a user visits the site. For instance, when a user visits /settings/themes?abc=123 with any major HTTP methods, ComfyPHP will look for a file named settings/themes.php inside the pages folder. If such a file doesn't exist, ComfyPHP will then search for settings/themes/index.php instead. It will only return no results if neither themes.php nor index.php files are created.

About .env

To store different environment variables, you can create multiple .env files, with their priorities determining the order as shown below:

Example

You can add different variables inside the env files like the example below:

After the process, you can use the variables within the pages.

404 Error Handling

For the 404 error, ComfyPHP will send a 404 status back to the client. You can add a file named _404.php to the pages folder. This file will serve as the error handling page when a client tries to access a page that cannot be found in the router.

Tool Functions

ComfyPHP provides you with some useful tools to simplify building your project. You may take a look at them.

But don't forget the initialize the class first before using them:

useLog

This function helps you print console.log messages in JavaScript.

useError

This function helps you print console.error messages in JavaScript.

useFilter

This function helps you escape some special values that may cause XSS attacks.

Reserved Variables of ComfyPHP

License

This project is MIT licensed, you can find the license file here.


All versions of core with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 comfyphp/core contains the following files

Loading the files please wait ....