PHPackages                             parfaitementweb/wordpress-starter-theme - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. parfaitementweb/wordpress-starter-theme

AbandonedArchivedLibrary

parfaitementweb/wordpress-starter-theme
=======================================

1.2.1(6y ago)9672MITPHP

Since Jan 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/parfaitementweb/wordpress-starter-theme)[ Packagist](https://packagist.org/packages/parfaitementweb/wordpress-starter-theme)[ RSS](/packages/parfaitementweb-wordpress-starter-theme/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (10)Used By (0)

Wordpress Starter Theme, done *Parfaitement*.
=============================================

[](#wordpress-starter-theme-done-parfaitement)

This Wordpress starter theme is built with Modern PHP development practises in mind.

This starter theme is based on the underscores.me file structure and only includes an additional and optional set of tools to ease your development. You can and will still develop your theme as any other basic Wordpress Theme.

The theme includes out-of-the-box
---------------------------------

[](#the-theme-includes-out-of-the-box)

- Composer
- Laravel Views Blade
- Controllers
- Laravel Mix
- Custom Gutenberg Blocks using ACF Blocks
- Laravel Collections
- Strings Helpers
- Tailwind CSS

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/9fc0d6c88daa7de99536ee84e9eb6e1276ac8d1e683a01760dbd3ff2e559e18d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70617266616974656d656e747765622f776f726470726573732d737461727465722d7468656d652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/parfaitementweb/wordpress-starter-theme)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/36305cd4daec8fdccd725e5fcccd883acbdc5f37a880ff1957a477103d843c10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617266616974656d656e747765622f776f726470726573732d737461727465722d7468656d652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/parfaitementweb/wordpress-starter-theme)

Installation
------------

[](#installation)

Execute the following commands:

```
cd wp-content/themes
composer create-project parfaitementweb/wordpress-starter-theme

cd yourtemplatename
npm install
npm run watch

# Build your assets for production using
# npm run production
# Read more about Laravel Mix on their official documentation.

```

---

Controllers
-----------

[](#controllers)

Default Wordpress templates files (such as index.php, page.php, etc.) are now your Controllers. Define in them all the logic for the specified template.

### How to use

[](#how-to-use)

1. The Wordpress template file should not directly return HTML or PHP code.
2. You should a call our core library using `$core = new Parfaitement\Core;` . This is going to intantiate an object with a lot of the common functions we need across the site.
3. Return your [Laravel Blade](https://laravel.com/docs/5.7/blade) using the `$core->render($view, $data)` method. `$view` is the name of the view (without `.blade.php` extension). `$data` is an array of variables you want to pass to the view.

    > Views are saved under the resources/views folder.

The `$core` variable offers additional features:

- Access The [Laravel HTTP Request](https://laravel.com/docs/5.7/requests) using `$core->$request`It's useful for retrieving input with `$core->request->input('name')` by exemple.
- Inject specific a CSS file for **this template only** using `$core->include_style()`
- Inject specific a JS file for **this template only** using `$core->include_script()`

Views
-----

[](#views)

Blade views `*.blade.php` are stored under the `resources/views` folder and are parsed using the [Laravel Blade](https://laravel.com/docs/5.7/blade) template engine.

Assets
------

[](#assets)

All assets are stored in the `resources/assets` folder. Normally as follow:

- resources/assets/images
- resources/assets/js
- resources/assets/sass

Assets are compiled using [Laravel Mix](https://laravel-mix.com/docs/4.0/basic-example). Laravel Mix is a clean layer on top of webpack to make the 80% use case laughably simple to execute.

Out-of-the box, it includes:

- Minification &amp; Compression
- JS with ES2017, Vue Support, Hot Replacement
- CSS Preprocessors. LESS, SASS, Stylus &amp; PostCss
- Browsersync
- Cache-busting (Automatic versioning)

> CSS files are processed using *POSTCSS* by default.

#### mix()

[](#mix)

We've added support for the `mix()` helper for cache-busting from within your template. When using `$core->include_style()` or `$core->include_script()` in your controllers, your scripts ans styles will be automatically cache-busted.

#### Linking to assets from templates

[](#linking-to-assets-from-templates)

Link your assets (images, icon, ...) using our custom `asset()` helper.

```
`

```

Tailwind CSS
------------

[](#tailwind-css)

This theme comes with [Tailwind CSS](https://tailwindcss.com), an utility-CSS framework pre-installed. You can still remove it form the `package.json` dependencies and edit the CSS style as you like.

> CSS files are processed using *POSTCSS* by default.

Forms
-----

[](#forms)

Custom Form can be handle this way:

In your `page.php`

```
$validator = $core->validation->make(
    $core->request->input(),
    [
        'name' => 'required',
        // other rules
    ]
);

if ($validator->fails()) {
    $errors = $validator->errors();
}

$data = [
    'errors' => $errors
];
$core->render('page', $data);

```

In your page.blade.php

```
    @if (isset($errors) && $errors->any())

            @foreach ($errors->all() as $error)
                {{$error}}
            @endforeach

    @endif

```

In `app/ContactForm/php`

```
