This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified README + Added docs for theme command
re-format docs
- Loading branch information
Showing
12 changed files
with
676 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,41 @@ | ||
## Sample Blog with API-based CMS | ||
## Prismic & PHP Example Blog | ||
|
||
This is a sample blog template in PHP with content managed in prismic.io (an API-based CMS). | ||
[PHP](https://www.php.net/) example blog project with content managed in [Prismic](https://prismic.io/) | ||
|
||
#### Getting started | ||
|
||
Read [this guide](https://intercom.help/prismicio/examples/php-samples/sample-blog-with-api-based-cms-in-php) for instructions to create your repository and use the sample blog. | ||
|
||
#### Deploy your PHP blog | ||
|
||
An easy way to deploy your blog is to use [Heroku](http://www.heroku.com). Just follow these few simple steps once you have successfully [signed up](https://id.heroku.com/signup/www-header) and [installed the Heroku toolbelt](https://toolbelt.heroku.com/): | ||
|
||
Create a new Heroku application | ||
|
||
``` | ||
$ heroku create | ||
``` | ||
|
||
Initialize a new Git repository: | ||
## Check out the dedicated article to get this project up and running | ||
> [Prismic project guide](https://user-guides.prismic.io/en/articles/868735-sample-blog-with-api-based-cms-in-php) | ||
### 1. Install the prismic-cli | ||
``` | ||
$ git init | ||
$ heroku git:remote -a your-heroku-app-name | ||
npm install -g prismic-cli | ||
``` | ||
|
||
Commit your code to the Git repository and deploy it to Heroku: | ||
|
||
### 2. Run the theme command | ||
This will create a new Prismic content repository, setup the custom types, and install the project code | ||
``` | ||
$ git add . | ||
$ git commit -am "make it better" | ||
$ git push heroku master | ||
prismic theme --theme-url https://github.com/prismicio/php-blog --conf prismic-configuration.json | ||
``` | ||
|
||
Ensure you have at least one node running: | ||
### 3. Update your repo name | ||
Open your config.php file and update your-repo-name with your repository name | ||
|
||
``` | ||
$ heroku ps:scale web=1 | ||
define('PRISMIC_URL', 'https://your-repo-name.prismic.io/api/v2'); | ||
``` | ||
|
||
You can now browse your application online: | ||
|
||
### 4. Run the project | ||
``` | ||
$ heroku open | ||
composer install | ||
./serve.sh | ||
``` | ||
|
||
Then you can access it at [http://localhost:3000](http://localhost:3000). | ||
## Learn more about using Prismic with PHP | ||
[Prismic PHP Documentation](https://prismic.io/docs/technologies/getting-started-php) | ||
### Licence | ||
|
||
This software is licensed under the Apache 2 license, quoted below. | ||
|
||
Copyright 2017 Prismic.io (http://www.prismic.io). | ||
Copyright 2021 [Prismic.io](http://www.prismic.io). | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"Main": { | ||
"headline": { | ||
"type": "StructuredText", | ||
"config": { | ||
"single": "heading1", | ||
"label": "Headline", | ||
"placeholder": "Main title..." | ||
} | ||
}, | ||
"description": { | ||
"type": "StructuredText", | ||
"config": { | ||
"multi": "heading2", | ||
"label": "Description", | ||
"placeholder": "Sub-title..." | ||
} | ||
}, | ||
"image": { | ||
"type": "Image", | ||
"config": { | ||
"constraint": { | ||
"width": 140, | ||
"height": 140 | ||
}, | ||
"thumbnails": [], | ||
"label": "Image" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"id": "blog_home", | ||
"name": "Blog home", | ||
"repeatable": false, | ||
"value": "blog_home.json" | ||
}, | ||
{ | ||
"id": "post", | ||
"name": "Post", | ||
"repeatable": true, | ||
"value": "post.json" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{ | ||
"Blog Post": { | ||
"uid": { | ||
"type": "UID", | ||
"config": { | ||
"label": "UID", | ||
"placeholder": "unique-identifier-for-blog-post-url" | ||
} | ||
}, | ||
"title": { | ||
"type": "StructuredText", | ||
"config": { | ||
"single": "heading1", | ||
"label": "Title", | ||
"placeholder": "Blog Post Title..." | ||
} | ||
}, | ||
"date": { | ||
"type": "Date", | ||
"config": { | ||
"label": "Date" | ||
} | ||
}, | ||
"body": { | ||
"type": "Slices", | ||
"fieldset": "Slice zone", | ||
"config": { | ||
"labels": { | ||
"image_with_caption": [ | ||
{ | ||
"name": "emphasized", | ||
"display": "Emphasized" | ||
}, | ||
{ | ||
"name": "image-full-width", | ||
"display": "Full" | ||
} | ||
] | ||
}, | ||
"choices": { | ||
"text": { | ||
"type": "Slice", | ||
"fieldset": "Text", | ||
"description": "A rich text section", | ||
"icon": "text_fields", | ||
"non-repeat": { | ||
"text": { | ||
"type": "StructuredText", | ||
"config": { | ||
"multi": "paragraph, preformatted, heading2, heading3, strong, em, hyperlink, embed, list-item, o-list-item, o-list-item", | ||
"allowTargetBlank": true, | ||
"label": "Text", | ||
"placeholder": "Post text..." | ||
} | ||
} | ||
}, | ||
"repeat": {} | ||
}, | ||
"quote": { | ||
"type": "Slice", | ||
"fieldset": "Quote", | ||
"description": "A quote section", | ||
"icon": "format_quote", | ||
"non-repeat": { | ||
"quote": { | ||
"type": "StructuredText", | ||
"config": { | ||
"single": "paragraph", | ||
"label": "Quote", | ||
"placeholder": "Post Quote..." | ||
} | ||
} | ||
}, | ||
"repeat": {} | ||
}, | ||
"image_with_caption": { | ||
"type": "Slice", | ||
"fieldset": "Image with Caption", | ||
"description": "An image with an optional caption", | ||
"icon": "image", | ||
"non-repeat": { | ||
"image": { | ||
"type": "Image", | ||
"config": { | ||
"constraint": { | ||
"width": 1200 | ||
}, | ||
"thumbnails": [], | ||
"label": "Image" | ||
} | ||
}, | ||
"caption": { | ||
"type": "StructuredText", | ||
"config": { | ||
"single": "heading3", | ||
"label": "Caption", | ||
"placeholder": "Image Caption..." | ||
} | ||
} | ||
}, | ||
"repeat": {} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...en-us/XFGkzBAAACAARSzM=#=XFGkzBAAACAARSzN=#=blog_home=#=XFGkzBAAACAARSzO=#=en-us=#=y.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"headline": [ | ||
{ | ||
"type": "heading1", | ||
"content": { "text": "John Doe Journal", "spans": [] } | ||
} | ||
], | ||
"description": [ | ||
{ | ||
"type": "heading2", | ||
"content": { "text": "Product designer @prismic.io 🇫🇷", "spans": [] } | ||
} | ||
], | ||
"headline_TYPE": "StructuredText", | ||
"headline_POSITION": 0, | ||
"description_TYPE": "StructuredText", | ||
"description_POSITION": 1, | ||
"image_TYPE": "Image", | ||
"image_POSITION": 2, | ||
"slugs_INTERNAL": ["john-doe-journal"], | ||
"image": { | ||
"origin": { | ||
"id": "XFGVghAAACAAROkk", | ||
"url": "https://prismic-io.s3.amazonaws.com/react-blog-demo%2F691648d2-9ed3-4deb-90d6-5a9705341586_554d95ad6f26328ba9cd274560a493aad98fc6dd_photo-1422568374078-27d3842ba676.jpeg", | ||
"width": 627, | ||
"height": 587 | ||
}, | ||
"alt": null, | ||
"credits": null, | ||
"width": 140, | ||
"height": 140, | ||
"edit": { | ||
"zoom": 0.23850085178875638, | ||
"crop": { "x": -5, "y": 0 }, | ||
"background": "#fff" | ||
}, | ||
"thumbnails": {}, | ||
"url": "https://prismic-io.s3.amazonaws.com/react-blog-demo/f5f3b73a4b954234c7d3008f7ee15e616e23ce82_554d95ad6f26328ba9cd274560a493aad98fc6dd_photo-1422568374078-27d3842ba676.jpeg" | ||
}, | ||
"uids_INTERNAL": [] | ||
} |
Oops, something went wrong.