Skip to content

Commit

Permalink
Merge pull request #4 from kethinov/1.0.1
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
kethinov authored Jun 4, 2020
2 parents 2cf0cab + 3fbc652 commit 70052ab
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/.ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

on: push
on: [push, pull_request]
name: CI
jobs:
test:
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@

- Put your changes here...

## 1.0.1

- Renamed package from `express-php-view-engine` to `php`. Thanks to Elmer Bulthuis for transferring the package name.
- Various dependencies bumped.

## 1.0.0

- Initial version.
- Initial version of superseding project.
- `express-php-view-engine` notably does not attempt to finish the work of the old `php` module. Instead it allows the native PHP parser to execute as a child process within Express applications.

## 0.0.1

- Initial version of original project.
- Originally the `php` module on npm was used by a separate project that attempted to implement a PHP parser in JavaScript for Node.js, but was never finished. One work in progress version was published, then the project remained stale for 8 years.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# express-php-view-engine

[![Build Status](https://github.com/rooseveltframework/express-php-view-engine/workflows/CI/badge.svg
)](https://github.com/rooseveltframework/express-php-view-engine/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/rooseveltframework/express-php-view-engine/branch/master/graph/badge.svg)](https://codecov.io/gh/rooseveltframework/express-php-view-engine) [![npm](https://img.shields.io/npm/v/express-php-view-engine.svg)](https://www.npmjs.com/package/express-php-view-engine)
)](https://github.com/rooseveltframework/express-php-view-engine/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/rooseveltframework/express-php-view-engine/branch/master/graph/badge.svg)](https://codecov.io/gh/rooseveltframework/express-php-view-engine) [![npm](https://img.shields.io/npm/v/php.svg)](https://www.npmjs.com/package/php)

This module allows you to use [PHP](https://php.net) as a templating system for [Express framework](https://expressjs.com) applications. This module was built and is maintained by the [Roosevelt web framework](https://github.com/rooseveltframework/roosevelt) [team](https://github.com/orgs/rooseveltframework/people), but it can be used independently of Roosevelt as well.

## Usage

First declare `express-php-view-engine` as a dependency in your app.
First declare `php` as a dependency in your app.

Then set PHP as a view engine in your Express app:

```js
const express = require('express')
const app = express()
const php = require('express-php-view-engine')
const php = require('php')

// setup php templating engine
app.set('views', path.join(__dirname, 'templates'))
Expand Down Expand Up @@ -45,12 +45,12 @@ Note: This module presumes that the system you run this on has PHP installed and

## Configuration

As shown in the above example, `express-php-view-engine` will register values from the Express model as global variables in your PHP script by default. You can disable this behavior if desired two ways:
As shown in the above example, this module will register values from the Express model as global variables in your PHP script by default. You can disable this behavior if desired two ways:

Disable registering globally:

```js
const php = require('express-php-view-engine')
const php = require('php')
php.disableRegisterGlobalModel()
// can be reenabled by calling php.enableRegisterGlobalModel()
```
Expand All @@ -65,4 +65,3 @@ app.get('/', (req, res) => {
})
})
```

58 changes: 37 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "express-php-view-engine",
"name": "php",
"description": "Allows you to use PHP as a view engine for Express applications.",
"author": "Roosevelt Framework Team <rooseveltframework@gmail.com>",
"contributors": [
Expand All @@ -8,7 +8,7 @@
"url": "https://github.com/rooseveltframework/express-php-view-engine/graphs/contributors"
}
],
"version": "1.0.0",
"version": "1.0.1",
"files": [
"index.js",
"loader.php"
Expand Down

0 comments on commit 70052ab

Please sign in to comment.