Download the PHP package hi-folks/fusion without Composer

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

Fusion

Latest Version on Packagist Total Downloads
Packagist License Packagist PHP Version Support GitHub last commit
Tests

Fusion is a Laravel package designed to manage Markdown content via Eloquent Models, eliminating the necessity for a conventional database setup. It achieves this by leveraging Markdown files enhanced with Frontmatter.

Laravel package that enhances Eloquent models to facilitate the management of structured, database-free content through Markdown files with Frontmatter.

Fusion aids in website development by integrating the power of Markdown and Frontmatter, enabling developers to create content-driven Web sites without having to manage databases.

With Fusion, developers can leverage the simplicity of Markdown syntax combined with the flexibility of Frontmatter to seamlessly organize and structure content.

By parsing Frontmatter into Eloquent models, Fusion enables developers to create complex, structured websites with ease. Say goodbye to the complexities of database management and welcome simplified website development with Fusion.

[!WARNING] The package is under development (version 0.0.x), so the functions, classes and methods provided can be changed, especially for the FusionBaseModel model class. So, if you want to start using the package in order to provide feedback, you are welcome, but please don't use it in production until the version 1.0.0 will be released. Thank you

Installation

You can install the package via the composer tool:

Usage

Once you installed Fusion you can start the process of creating content in Markdown files and querying the files through the Models. For example, now we are going to create articles in Markdown format and we will parse and query them like you can do it with a database.

Creating the content

In the resources/content directory, you can create the article directory. In the resources/content/article, you can create your Markdown files with a frontmatter header like for example:

you can name this file as resources/content/article/article-1.md You can create similarly the other Markdown files. These files represent your articles.

Creating the Model

Similarly, you are doing with a database, you can create your model for loading the markdown files. Because you are creating articles you can create your model as app/Models/Article.php.

You can fill the file in this way:

Consider that:

Creating automatically the Model

If you want to create automatically the Model file, based on the structure and the content of the Markdown files you can use the fusion:sync-model command:

The path parameter sets the directory of the markdown files for a specific model (like article, page, post, project etc.). The --create-model option will generate automatically the Model file based on the content and the frontmatter section of the Markdown files. Without the --create-model option the fusion:sync-model command will list some information detected from Markdown like the name of the Model and the list of the fields.

Querying the content

Now in your Controllers or your Blade components, you can use the Article model with the usual method like where(), orderBy() etc:

Advanced Usage

Once you understand the basics of using Fusion with your Markdown files, you can use some of the advanced features. Consider that Fusion is a LAravel Package and during the design and the implementation of the Package we try to use and adhere to as much as possible the Laravel functionalities. With this approach, we think that we can inherit all the benefits of some Laravel features. Some of these feature that we explore and explain in the next sections are:

Adding real-time page reload

If you want the browser to automatically reload the pages when you change some content in the Markdown files you can set the refresh option in the laravel Vite plugin. In the vite.config.js file add the refresh option with the list of the folder you want that Vite will "watch" for changes and reload the page.

In the example, the resources/content directory is added.

If you need to setup the Vite asset bundling you can take a look at the LAravel documentation: https://laravel.com/docs/11.x/vite

Using dates in the Markdown files

If you want to use date (or date-time) in your front matter you can use the format YYYY-MM-DD in the Frontmatter for example:

Then in the Model you can set the casting in this way:

Where date is the field name, the same name you are using in the Markdown.

If you are adding a new field, remember to add the field name in the list of the frontmatter field in the frontmatterFields() function in the Model:

If you are interested into exploring more the attribute casting in the Laravel Model you can take a look at The Laravel Eloquent attribute casting documentation.

Using collections in the Markdown files

If you need to manage complex data in the Markdown, like for example a list of tags you can use the arrays in the Frontmatter:

In the example, we are adding a field named head which is an array of values for tag and content.

In the Model file, you have to cast properly the head field as collection.

So that in your blade files, you can loop through the head field and access to tag or content sub-fields:

Customizing the slug

By default, the slug of a content is the filename without the extension. Now you can customize the slug using the frontmatter attribute slug. For example:

Using the Check Markdown command

To inspect the Markdown files and show and list the Frontmatter fields you can use the Artisan command fusion:check.

Using the Check Model command

To inspect the Model file and check if it extends the right class and uses the proper Traits to be a Model compatible with Markdown files, you can use the fusion:check-model command:

The output will tell you if your model is correct or not:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please open an issue in the tracker using the "New issue" functionality.

Credits

License

The MIT License (MIT). Please see License File for more information.

References

We built this Open Source project using some nice and powerful Open Source libraries like:

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of fusion with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3
calebporzio/sushi Version ^2.5
illuminate/support Version ^11.0
league/commonmark Version ^2.4
spatie/commonmark-highlighter Version ^3.0
spatie/yaml-front-matter Version ^2.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 hi-folks/fusion contains the following files

Loading the files please wait ....