Download the PHP package bozboz/jam without Composer

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

Jam Package

Contents


1. Installation

  1. Require the package in Composer, by running composer require bozboz/jam
  2. Add Bozboz\Jam\Providers\JamServiceProvider::class to the providers array config/app.php - NOTE: This must be above the RouteServiceProvider or routes will not sequence correctly. Add it to the pre-existing bozboz serviceproviders.
  3. Run php artisan vendor:publish && php artisan migrate
  4. Jump to 3. Usage for the default catchall route

2. Data Setup

2.1. Types

Entity types (a.k.a Types) are the top level of the jam schema. They can essentially be thought of as models, or a logical grouping of models (todo:clarify), since the templates actually have the fields. Types are registered in an app's service providers, eg

Jam has a preregistered "pages" NestedType, since most apps are going to need one (NestedType is for entities requiring nested sort).

Type attributes

2.2. Templates

Data fields for entity types are defined by adding/creating templates. Types can have multiple templates. To add a template, log in to the admin, click on "Jam" then pick a type to edit.

When adding a template you must give it a name and view but the listing view and max_uses values are optional. The view field will be used in the default render method to pick what view to actually render. The implementation of listing_view is largely down to the requirements but its intention is that you could have multiple templates in a type that require different views in a listing. Once you've created a template the admin menu will acknowledge the type and display it in the the menu wherever the configured menu_builder dictates. max_uses allows you to limit the number of times a template may be used e.g. setting it to 1 will hide the option to create a new entity with that template after 1 is created (todo:example use case).

2.2.1. Migrating Templates

When you're making changes to templates in development the same changes will need to be made to the production database upon release. To aid with that there is a seeder generator and a history view for templates.

If you have created a brand new template that doesn't exist in the live database yet then your best bet it to use the seeder generator using the console command php artisan jam:make-seeder <type alias> <template alias>. This will generate a seeder that can be run on the live database to insert the template, all its fields and field options. The seeders generated will have a name created from the type and template aliases suffixed with "JamTemplate.php".

eg. php artisan jam:make-seeder pages text-page would generate a seeder named PagesTextPageJamTemplate.php so once deployed to the live server it would be run using php artisan db:seed --class=PagesTextPageJamTemplate

If you're not creating whole new templates but rather changing parts of existing templates then the best thing to do is view the history for that template and manually redo the changes shown there on the production database after the work has been deployed.

2.3. Fields

A template is made up of a list of fields. Jam comes with the following field types:

If you needed any functionality not listed above (eg. to define a relationship between an entity template and an app's custom model not stored in Jam) you may create any number of custom field types by extending the Bozboz\Jam\Fields\Field class and registering the field type in a service provider using the FieldMapper registered in the service container.

2.4. Entities

Generally you won't need more than the default functionality in the package and you shouldn't interact directly with the Entity class itself. See 3.2. EntityRepository for info on how to fetch entities.

2.5. Revisions

Every time you save an entity it will create a revision in the entity_revisions table and a new set of values. This allows you to track changes across entities or revert back to previous states.


3. Usage

3.1. Catchall Route

Jam doesn't have any frontend routes set up by default but it does have a controller that your app can point some routes at.

Generally you'll want to add a catchall route right at the end of your routes file which will handle most if not all of your entity routing. This will use the paths table to lookup the entity based on the request path and serve it up in the view its template has configured.

3.2. EntityRepository

Manual retrieval of entities should be done using the forType method on the Bozboz\Jam\Repositories\EntityRepository class. This will return a new query builder for the correct entity class registered to the type and limited to entities of that type.

3.3. Listings & Other Data

Some pages will require more data than just the entity so you will need to create a view composer for the current view. These should be added to app/Http/ViewComposers and registered in the boot method of a ComposerServiceProvider service provider.

3.4. Canonical Paths

Every entity with a link builder will have a canonical path which most of the time will be the path you'll want to use when linking to it from other pages/menus. When querying entities you should use the withCanonicalPath scope in order to eager load it or when working with a collection use the loadCanonicalPath method to lazy load it. Use $entity->canonical_path to output it.

3.5. Value Retrieval

Just querying the entities will only give you the data from the entities table, in order to load the values you must call the loadFields method on either a single or collection of entities. The method takes a list of fields to load or will load all fields if no arguments given.

e.g.

If you need to load values for a belongs to or belongs to many entity relation then you can use the loadRelationFields(string $relationName, mixed $field/s) method. This will also check that the relation itself is loaded and load it if not so you don't have to load it beforehand.

e.g.


4. Search Indexing

Jam supports indexing entities via elastic search but each type needs to be set up with a search handler, see 2.1. Types. If all you need to be indexed is the name of the entity then you can just use the base Bozboz\Jam\Entities\Indexer class. In the likely event that you need more than that each type will need a handler written for it. When setting up a search handler class for an entity type it should extend the bas Indexer class and override the getPreviewData and getSearchableData methods.

The purpose of getPreviewData is to transform the entity in to a suitable format for your search results view and getSearchableData is for returning all the values you want to be searchable as one long string.

e.g.


All versions of jam with dependencies

PHP Build Version
Package Version
Requires bozboz/admin Version >2.1
kalnoy/nestedset Version 3.1 - 4.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 bozboz/jam contains the following files

Loading the files please wait ....