Download the PHP package esyede/orbit-backport without Composer

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

Laravel v7.x PHP 7.2+

Orbit is a flat-file driver for Laravel Eloquent. It allows you to replace your generic database with real files that you can manipulate using the methods you're familiar with.

Installation

To install Orbit, run the following command in your project:

Usage

To begin using Orbit, create a Laravel model and use the Orbit\Concerns\Orbital trait.

The Orbital trait is responsible for hooking into the Eloquent lifecycle and ensuring all of your interactions are handled correctly.

Defining the Schema

Just like a database migration, you need to define the different pieces of data that your Orbit model can have. Add a public static function schema(Blueprint $table) method to your model.

This method will need to accept an instance of Illuminate\Database\Schema\Blueprint, just like a migration.

If some of your data is optional, make sure the corresponding column is nullable.

Storing content

By default, all content is stored inside of a content folder in the root of your application. If you wish to change this, publish the orbit.php configuration file and change the orbit.paths.content option.

Orbit will transform the base name of your model into a pluralized snake-cased string and use that as the main folder name, e.g. Post -> content/posts, PostCategory => content/post_categories.

🚨 Changing the name of a model will prevent Orbit from finding any existing records in the old folder. If you wish to change the name of the folder, overwrite the public static function getOrbitalName method on your model class and return the old name instead.

Any time you call Model::create(), Model::update or Model::delete, Orbit will intercept those calls and forward to the necessary driver method. The driver is then responsible for performing the necessary file system calls.

Changing the primary key

Just like a normal Eloquent model, you can change the primary key of your Orbit model. Overwrite the Model::getKeyName method and return the name of your new model.

If your model's primary key (the key you defined in getKeyName) doesn't need to automatically increment, you should either define public $incrementing = false on the model or overwrite the getIncrementing method.

Standard Orbit drivers will respect the new key name and use that when creating, updating and deleting files on disk, e.g. a Post with the slug hello-world will write to the content/posts/hello-world.md file.

🚨 Changing the key for a model after records already exist can cause damage. Be sure to rename your files afterwards so that Orbit doesn't create duplicate content.

Soft Deletes

Since Orbit needs to update files on disk when your model is updated, the standard Eloquent SoftDeletes trait doesn't quite work. If you want to add soft delete support to your Orbit model, you can instead use the Orbit\Concerns\SoftDeletes trait.

This trait uses the Eloquent one under-the-hood, so you can still access all of your normal SoftDeletes methods, including isForceDeleting() and forceDelete().

The Orbit version adds in the necessary hooks to perform file system operations as well as ensure you don't completely delete your content.

Validation Rules

When dealing with validation rules that check against a database like exists and unique, you should use the fully-qualified namespace (FQN) of the model instead of the table name.

This is because Orbit runs on a separate database connection - using the FQN will allow Laravel to correctly resolve the qualified table name.

Testing

As previously mentioned in the Validation Rules section, Orbit operates on a custom connection called orbit. This means that Laravel's database testing utilities will work, as long as you specify the connection name.

Drivers

Orbit is a driver-based package, making it very easy to change the storage format of your data.

Out of the box, Orbit provides the following drivers:

md

This is a Markdown that is capable of parsing Markdown files, as well as YAML front-matter.

When Orbit loads files using this driver, it will map each front-matter key into a column in your models schema.

By default, the Markdown driver will also add a TEXT content column to your schema. This is used to store the Markdown body from the file.

💡 If you wish to customise the name of the content column, you can use the Markdown::contentColumn() method and provide a new column name. This is applied to all models that use the Markdown driver.

json

This is a JSON driver that is capable of parsing .json files. Each key in the file is mapped to a column in your schema.

yaml

This is a YAML driver that is capable of parsing .yml files. Each key in the file is mapped to a column in your schema.

Registering drivers

You can register custom Orbit drivers by using the Orbit::extend method. You should call this method from the boot method in a ServiceProvider.

All drivers must implement the Orbit\Contracts\Driver contract, or extend the Orbit\Drivers\FileDriver class. This enforces drivers to have at least 4 methods:

Here is what each method is used for:

Extending FileDriver

Extending the Orbit\Drivers\FileDriver class is useful when you want some of the heavy lifting done for you. To work with this base class, you should do the following:

  1. Implement an extension(): string method that returns the file extension as a string, i.e. return 'md' for Markdown.
  2. Implement a dumpContent(Model $model): string method. This method should return the updated content for the file.
  3. Implement a parseContent(SplFileInfo $file): array method. This method should return an array of key => value pairs, where each key is a column in the schema.

Changing drivers

If you wish to use a different driver for one of your models, you can add a public static $driver property to your model and set the value to the name of a driver.

Driver names are determined when they are registered with Orbit. You should always use the string name of the driver instead of the fully-qualified class name.

Disabling Orbit

If you have a model that uses the Orbital trait and would like to temporarily disable Orbit's functionality, you can override the enableOrbit(): bool method on your model:


All versions of orbit-backport with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5|^8.0
ext-json Version *
illuminate/console Version ^7.0
illuminate/database Version ^7.0
illuminate/events Version ^7.0
illuminate/support Version ^7.0
spatie/yaml-front-matter Version ^2.0
symfony/yaml Version ^3.0|^4.0|^5.0|^6.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 esyede/orbit-backport contains the following files

Loading the files please wait ....