Download the PHP package totallyquiche/crudy without Composer

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

CRUDy

CRUDy is a proof-of-concept PHP framework with no dependencies.

But why?

For fun, of course! After all, learning is FUNdamental! :rainbow:

CRUDy is helping me hone my PHP skills and understand more about the concepts popular PHP frameworks are built on.

CRUDy is not meant to be used in production. CRUDy development starts with the naive approach instead of with existing standards (e.g. PSR). I then develop these implementations over time as I learn the pros and cons of different patterns. Compatibility, performance, and even security are not priorities and are not guaranteed.

Feedback is still welcome! You can even open up a Pull Request if you'd like. :smile:

Features

Getting Started

  1. Clone the repo: git clone [email protected]:totallyquiche/CRUDy.git
  2. Create your config file: cp .env.example .env
  3. Start your PHP server: php -S localhost:80
  4. Open http://localhost in your browser

Technically, that's it! CRUDy is up and running! But you probably want to do more than that...

Create a New Page

Add a new route to the $routes array in ./App/Http/routes.php. You can either specify a controller and method or an anonymous function. The method/function you define should return a string (this is what gets rendered).

Create a Controller

Create a new class in App/Controllers/Http that extends App\Http\Controllers\HttpController. The class name should end with Controller (e.g. HomeController). The file name should be the class name plus .php (e.g. HomeController.php).

The controller should contain methods matching any register routes you have. For example, if I have registerd a route referencing HomeController::index, then I should have a controller named HomeController with a method named index() which returns a string.

Create a View

Create a new .php file in App/View/Templates. Load the view from your controller by calling $this->renderView($view_name, $args) in the controller method.

The first parameter is the name of the view (without .php). The second parameter is an optional array of data to be passed to the view. The key/value pairs in the array are turned into variables with assigned values.

For example, calling the below method call will result in the the show_object view (App/View/Templates/show_object.php) being loaded. The view will have access to a variable called $object_name with the value Object Name;

A values in $args can also be a Callable. For example, calling the method below will give the view access to a variable called $message with the value Hello, World!:

Templates

Templates may be used to support a type of single-inheritance View in which the string {{ 💩 }} in the Template is replaced with the contents of the View.

Using a Template

To use a Template, ensure that the first line of your View file contains a string like {{ TEMPLATE_NAME }}, wherein TEMPLATE_NAME is the file name of the Template without .php. For example, the following View would utilize a template located at App\View\Templates\page.php:

Creating a Template

Templates are files with names matching [a-zA-Z]+\.php (e.g. page.php) and live in App\View\Templates. The should contain a single placeholder, {{ 💩 }} for embedding View within them. For example:

which, with the following View...

...results in the following being rendered:

View Caching

After a View has been fully compiled, it is written to a cache located at ./App/View/Templates/Cache. That cached file is used each time the corresponding page is requested until the cache period expires (the number of seconds the VIEW_CACHE_SECONDS_TO_EXPIRY environment variable is set to).

Testing

Writing Tests

Create a new class in ./App/Tests that extends App\Tests\Test. The class name should end with Test (e.g. HomeControllerTest). The file name should be the class name plus .php (e.g. HomeControllerTest.php).

Your test methods should be public, should start with test_, and should return a boolean indicating whether the test passed.

Running Tests

As long as you follow the above naming conventions, your tests will be run automatically through the following command:

You can run specific tests by passing in their name as arguments:

Test results

After running your tests, you will see the results printed to the screen.

Each test cass will be displayed starting with Passed or Failed. The total pass/fail counts will be displayed at the end.


All versions of crudy 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 totallyquiche/crudy contains the following files

Loading the files please wait ....