Download the PHP package jhuddle/framework without Composer

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

framework

Requires PHP 8.1.0 or later

Ultra-minimal PHP, erm, framework.

Oh no, not another one...

Fair point - but this one is really small and super useful, promise.

How small?

Just under 10 kB. You'll hardly know it's there.

Go on then. How do I get started?

Let's start at the very beginning; a very good place to start. From your project root folder:

Note that in each case, the route handling methods get() and post() - or put(), patch(), delete(), whatever you need - take two arguments:

Hopefully you might already have an idea how this works by now...

Yeah, looks simple enough - what's this 'view' => dir('../templates') all about though?

This tells your App instance where to find the PHP templates for generating your site's HTML; the framework isn't expecting any particular folder structure, so you need to tell it which base folder to look in. In fact, the array key doesn't even have to be named view: you could call it template instead, or html, or whatever you prefer! And you can even have multiple array keys, each referring to a different base folder.

Whichever names you choose will be used to create new callable Resource properties on the app instance: when invoked with a file path (relative to the base folder), these create anonymous class objects which include the file whenever used as a string, and which extract an optional array of variable names and values for use within that file's context, e.g.:

But that's not all! Besides base folders wrapped in dir(), you can add/overwrite anything you like to your App instance, at any time, either during instantiation or by calling the use() method:

Cute. What else can it do?

It not only handles requests, it can also make them:

Behind the scenes, the request objects were loaded into the app in just the same way as we've seen above - so it's possible to override them in the constructor or with use(), if you want to use a different implementation.

Same goes for db - if the right environment variables are available in the execution context, the framework will establish a PDO connection based on the value of DBMS, using DB_HOST, DB_PORT, DB_NAME, DB_USER and DB_PASS for credentials. The included implementation comes with a couple of common helper methods for prepared statements and transactions, but you can override db with another if you like:

And there's also session, a very simple wrapper for the built-in PHP session management functions - by default, the framework starts a session unless false is passed as the second argument to the App constructor.

OK, sounds good - is that everything?

Yes and no! We've now touched each of the six small classes that make up this framework, but there's a lot more you can do with them...

And there's probably a bunch of other possible patterns for a bunch of other use cases that I didn't think of yet... the goal of this project is to write the smallest, least-opinionated, most extensible and most useful PHP framework possible, so it's over to you and your imagination from here!

Awesome, thank you! How can I contribute?

The best contribution you can make to this framework is simply to use it, and report any issues... and if you build something cool with it, please let me know by adding a link to your GitHub repo/project website in a pull request to the Projects file! It'd be great to see what you come up with. 🙂


All versions of framework with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 jhuddle/framework contains the following files

Loading the files please wait ...