A simple starter kit for using TypedCMS with the Laravel framework.

Overview

TypedCMS Starter Kit for Laravel

Our stater kits are tailored solutions for each platform, unlike the simple API wrappers offered by other vendors. The TypedCMS starter kit for Laravel provides Eloquent like models, repositories, query caching and a simple mechanism for adding custom webhook controllers and handlers.

This starter kit wouldn't be possible without the hard work of the many open source package developers and contributors on which it is built.

Requirements

  • PHP 8+
  • Laravel 8+

Installation

First, install the package via the Composer;

composer require typedcms/laravel-starter-kit

This package will automatically register its service provider.

To publish the config file please run:

php artisan vendor:publish --provider="TypedCMS\LaravelStarterKit\Providers\StarterKitServiceProvider" 

Connecting to TypedCMS

To connect, you'll need an OAuth client application registered in TypedCMS.

Open your TypedCMS config file and set the client_id and client_secret to match your client application in TypedCMS. The redirect_uri should point to the display-code route provided by this package. If you’re using php artisan serve, this will be something like http://localhost:8000/display-code. If you need access to the management API, be sure to update the scope too. Leave the authorization_code for now.

Now run:

php artisan typedcms:connect

You’ll be asked for your client credentials, however you should see that they have been prefilled, so you can just press enter to skip through these until you’re given an authorization URL. Open this link in your browser and click the Authorize button, ensuring you're authorising the correct account. Copy the code displayed on the screen (Ctr+A then Ctr+C to make sure you get it all). Paste this code into the terminal where prompted. If it is verified successfully, you can now paste this code into the authorization_code property of your config file.

Be careful here as you're authorising access to all teams and projects that the authorised account has access to!

That's it! You're now connected to TypedCMS.

Usage

Repositories

To create a repository for a specific endpoint run:

php artisan typedcms:make:repository MyRepo -e=endpoint

Or for a specified blueprint and collection:

php artisan typedcms:make:repository MyRepo -b='blueprint-name' -c='collection-name'

The repositories will be your primary means of interacting with the TypedCMS API. This functionality is built on the incredible { json:api } Client package by SWIS. For usage documentation please refer to their documentation.

Generated repositories will be placed in the app/Repositories directory of your application.

A generated repository will look something like this:

<?php

declare(strict_types=1);

namespace App\Repositories;

use TypedCMS\LaravelStarterKit\Repositories\ConstructsRepository;
use TypedCMS\LaravelStarterKit\Repositories\Contracts\Cacheable;

class MyRepo extends ConstructsRepository implements Cacheable
{
    protected string $collection = 'collection-name';

    protected string $blueprint = 'blueprint-name';

    /**
     * When this repository's cache is cleared, repositories listed here will
     * also be cleared.
     */
    protected array $clears = [];

    /**
     * By default, repositories make requests to the delivery api. Set this to
     * true if you wish to use the management api by default.
     */
    protected bool $mapi = false;
}

By default, all responses are cached. If you would like to disable caching for a repository you can remove its Cacheable interface.

If your model only interacts with the management API, you can set its $mapi property to true. You can also switch any query to the management API fluidly with the mapi() method like so:

$myRepo->mapi()->all();

Models

To create a model for a specific resource type run:

php artisan typedcms:make:model MyModel -t='resource-name'

Or for a specified blueprint:

php artisan typedcms:make:model MyModel -b='blueprint-name'

Generated models will be placed in the app/Models directory of your application.

These are eloquent-like are built on the fantastic jenssegers/model package.

Resolvers

Repositories and models are automatically resolved using their respective resolvers. If you need to implement a different file structure, you can implement your own resolvers.

You might also like...
A starter kit that integrates Laravel with Vue CLI, Inertia.js, TailwindCSS and Vuetify
A starter kit that integrates Laravel with Vue CLI, Inertia.js, TailwindCSS and Vuetify

Laravel Viltify Laravel Viltify is a heavily opinionated Laravel starter kit. It's intent is to seamlessly integrate V ue, I nertia.js, L aravel, T ai

An administration starter kit for Laravel.
An administration starter kit for Laravel.

Craftable About Demo Packages used Requirements Installation New project Add to existing project Basics Documentation Where to go next? About Hi Craft

It's a dashboard theme/UI-Starter Kit with Laravel, Inertia and Vue (JetStream).

TailAdmin Inertia It's a dashboard theme/UI-Starter Kit with Laravel, Inertia and Vue (JetStream). Setup Directions npm install composer install Chang

Laravel Boilerplate / Starter Kit with Gentelella Admin Theme
Laravel Boilerplate / Starter Kit with Gentelella Admin Theme

Laravel Boilerplate Project Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications. Table of Con

An implementing of the Laravel Breeze application / authentication starter kit frontend in Next.js
An implementing of the Laravel Breeze application / authentication starter kit frontend in Next.js

Windmill with Laravel Breeze as Backend API Introduction This repository is an implementing of the Laravel Breeze application / authentication starter

Laravel Starter Kit (Inertia-SSR - Vue3 - Bootstrap 5)
Laravel Starter Kit (Inertia-SSR - Vue3 - Bootstrap 5)

Laravel Starter Kit (Inertia-SSR - Vue3 - Bootstrap 5) Use this starter kit to develop with Laravel 9 setup InertiaJs with Server Side Rendering (SSR)

Surf, an opinionated fork of Wave - the SAAS starter kit, with Laravel 9.
Surf, an opinionated fork of Wave - the SAAS starter kit, with Laravel 9.

Surf 🏄‍♀️ Introduction Surf, the opinionated Software as a Service Starter Kit that can help you build your next great idea 💰 . Surf is fork off Wav

This is a laravel Auth Starter Kit, with full user/admin authentication with both session and token auth

About Auth Starter It's a Laravel 8 authentication markdown that will help you to understand and grasp all the underlying functionality for Session an

An Starter Kit For Laravel Projects.
An Starter Kit For Laravel Projects.

Laravel Starter Kit An Starter Kit For Laravel Projects. Installation 1-Install the package via composer: composer require xmen/starter-kit --with-al

Owner
TypedCMS
TypedCMS is an API-first Headless CMS with a unique content modelling experience.
TypedCMS
Dynamic Framework :: A PHP starter kit for Noobs

A PHP starter kit for Noobs Author : Abdulbasit Rubeiyya The dynamic framework is not exactly a framework, but more of a starter kit for you, the thin

Abdulbasit Rubeiyya 1 Dec 16, 2022
A Laravel Starter Kit for Laravel. Built with Laravel 8.

Laravel Get Started Project Laravel Get Started Project is a basic crud app built with laravel 8. In this app a basic product crud created. Features i

Nazmul Hasan Robin 8 Nov 24, 2022
React laravel starter kit with tailwind css and vite js(laravel 9)

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Jerald Tonmoy Dias 2 Dec 23, 2022
Laravel API starter Kit will provide you with the tools for making API's that everyone will love

Laravel API Starter Kit Laravel API starter Kit will provide you with the tools for making API's that everyone will love, API Authentication is alread

Jose Luis Fonseca 400 Dec 29, 2022
Laravel + Livewire + Bootstrap 5 UI starter kit.

bastinald/ui Laravel + Livewire + Bootstrap 5 UI starter kit. Requirements Laravel 8 NPM Features Bootstrap 5 pre-configured Textarea autosize Floatin

null 83 Dec 26, 2022
a free, open-source dashboard panel starter kit for Laravel

QAdmin a free, open-source dashboard panel starter kit for Laravel. Just intall and everything is ready Tech Stack Client: ruangAdmin, Bootstrap, Jque

null 30 Oct 11, 2022
Laravel React Webpack Starter Kit

About Laravel Laravel React Webpack Starter Kit This starter kit is designed to get you up and running with with react.js with Laravel, built on top o

Biju Nakarmi 32 Nov 24, 2022
A Laravel-Nuxt starter kit.

Laravel-Nuxt A Laravel-Nuxt starter project template. Features Nuxt 2 Laravel 8 SPA or SSR Socialite integration VueI18n + ESlint + Bootstrap 4 + Font

Cretu Eusebiu 1.1k Jan 5, 2023
A Laravel-Vue-Tailwind SAAS Starter Kit.

Super SAAS Template My name is Julien Nahum, I've founded multiple Software-As-A-Service companies. This repo is the base I'm using to create a new SA

Julien Nahum 16 Dec 23, 2022
A Laravel-Vue SPA starter kit.

Laravel-Vue SPA A Laravel-Vue SPA starter kit. Features Laravel 8 Vue + VueRouter + Vuex + VueI18n + ESlint Pages with dynamic import and custom layou

Cretu Eusebiu 3k Jan 6, 2023