Skip to content

Commit

Permalink
Merge pull request #85 from bowphp/feat/queue-config
Browse files Browse the repository at this point in the history
refactor: update config and default view
papac authored Jan 18, 2025
2 parents 733675d + 100d551 commit aee1446
Showing 29 changed files with 115 additions and 105 deletions.
2 changes: 1 addition & 1 deletion app/Controllers/WelcomeController.php
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ class WelcomeController extends Controller
* Show index
*
* @param Request $request
* @return string
* @return string|null
*/
public function __invoke(Request $request): ?string
{
3 changes: 2 additions & 1 deletion app/Exceptions/ErrorHandle.php
Original file line number Diff line number Diff line change
@@ -13,8 +13,9 @@ class ErrorHandle extends BaseErrorHandler
* handle the error
*
* @param Exception $exception
* @return mixed|string
*/
public function handle($exception)
public function handle(Exception $exception): mixed
{
if (request()->isAjax()) {
return $this->json($exception);
10 changes: 8 additions & 2 deletions app/Models/User.php
Original file line number Diff line number Diff line change
@@ -2,9 +2,15 @@

namespace App\Models;

use Bow\Auth\Authentication as AuthenticatableModel;
use Bow\Auth\Authentication as AuthenticationModel;

class User extends AuthenticatableModel
/**
* @property mixed|string $name
* @property mixed|string $lastname
* @property mixed|string $email
* @property bool|mixed|string $password
*/
class User extends AuthenticationModel
{
/**
* The list of hidden field when toJson is called
4 changes: 2 additions & 2 deletions app/Services/UserService.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public function __construct(User $user)
/**
* Get all available users
*
* @return Collection
* @return Collection|null
*/
public function fetchAll(): ?Collection
{
@@ -38,7 +38,7 @@ public function fetchAll(): ?Collection
* @param string $name
* @param string $lastname
* @param string $email
* @return User
* @return User|null
*/
public function create(string $name, string $lastname, string $email): ?User
{
2 changes: 1 addition & 1 deletion bow
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use Bow\Console\Console;

// Register The Auto Loader
if (!file_exists(__DIR__."/vendor/autoload.php")) {
die("Please install the depencencies with 'composer update'");
die("Please install the dependencies with 'composer update'");
}

require __DIR__."/vendor/autoload.php";
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -16,8 +16,12 @@
},
"require": {
"php": "^8.1",
"bowphp/framework": "^5.0",
"bowphp/policier": "^3.0"
"bowphp/framework": "^5.x-dev",
"bowphp/policier": "^3.0",
"ext-pdo": "*",
"ext-redis": "*",
"ext-curl": "*",
"ext-ftp": "*"
},
"require-dev": {
"phpunit/phpunit": "^9",
4 changes: 2 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@
'name' => app_env('APP_NAME', 'Bow Application'),

/**
* The auto csrf enable csrf protected automaticly
* The auto csrf enable csrf protected automatically
* on POST, DELETE, PUT
*/
"auto_csrf" => app_env("APP_AUTO_CSRF", true),
"auto_csrf" => (bool) app_env("APP_AUTO_CSRF", true),

/**
* Root of the application
6 changes: 4 additions & 2 deletions config/cache.php
Original file line number Diff line number Diff line change
@@ -8,21 +8,23 @@
// The filesystem connection
"file" => [
"driver" => "file",
"path" => __DIR__ . '/../var/cache'
"path" => __DIR__ . '/../var/cache',
"prefix" => "",
],

// The database connection
"database" => [
"driver" => "database",
"connection" => app_env('DB_DEFAULT', 'mysql'),
"table" => "caches",
"prefix" => "",
],

// The redis connection
"redis" => [
'driver' => 'redis',
'database' => app_env('REDIS_CACHE_DB', 5),
"prefix" => "__app__",
"prefix" => "",
]
]
];
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
/**
* The database on which the default application will connect.
*
* The database by default, it is on this data base that will connects
* The database by default, it is on this database that will connect
* automatically. So you absolutely must not edit the default key.
*
* In the opposite box you must execute the code in each route.
17 changes: 9 additions & 8 deletions config/helpers.php
Original file line number Diff line number Diff line change
@@ -2,12 +2,13 @@

if (!function_exists('mix')) {
/**
* Get mixfile chunkhash version
* Get mix file chunk hash version
*
* @param string $path
* @return string
* @throws Exception
*/
function mix($path)
function mix(string $path)
{
$manifest = config('app.mixfile_path');

@@ -34,7 +35,7 @@ function mix($path)
* @param string $path
* @return string
*/
function public_path($path = '')
function public_path(string $path = ''): string
{
return __DIR__ . '/../public/' . ltrim($path, '/');
}
@@ -47,7 +48,7 @@ function public_path($path = '')
* @param string $path
* @return string
*/
function frontend_path($path = '')
function frontend_path(string $path = '')
{
return __DIR__ . '/../frontend/' . ltrim($path, '/');
}
@@ -60,7 +61,7 @@ function frontend_path($path = '')
* @param string $path
* @return string
*/
function storage_path($path = '')
function storage_path(string $path = '')
{
return __DIR__ . '/../var/' . ltrim($path, '/');
}
@@ -72,7 +73,7 @@ function storage_path($path = '')
*
* @return string
*/
function base_path($path = '')
function base_path($path = ''): string
{
return rtrim(rtrim(realpath(__DIR__ . '/..'), '/') . '/' . $path, '/');
}
@@ -86,7 +87,7 @@ function base_path($path = '')
* @param int $len
* @return string
*/
function gen_slix($len = 4)
function gen_slix(int $len = 4): string
{
return substr(str_shuffle(uniqid()), 0, $len);
}
@@ -98,7 +99,7 @@ function gen_slix($len = 4)
*
* @return string
*/
function gen_unique_id()
function gen_unique_id(): string
{
$id = base_convert(microtime(false), 10, 36);

4 changes: 2 additions & 2 deletions config/mail.php
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
"from" => "sender@example.com",

/**
* SMTP authentification
* SMTP authentication
*/
"smtp" => [
"hostname" => app_env("SMTP_HOSTNAME"),
@@ -33,7 +33,7 @@
],

/**
* SMTP authentification
* SMTP authentication
*/
"ses" => [
"profile" => app_env("SES_PROFILE", "default"),
2 changes: 1 addition & 1 deletion config/policier.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
"signkey" => app_env("APP_JWT_SECRET", "FivwuTmpJlwfXB/WMjAyMS0wMS0yNCAyMDozMTozMTE2MTE1MjAyOTEuMDEwOA=="),
"signkey" => app_env("APP_JWT_SECRET"),

/**
* Token expiration time
4 changes: 2 additions & 2 deletions config/queue.php
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@

return [
/**
* The defaut connexion
* The default connexion
*/
"default" => "beanstalkd",
"default" => "sync",

/**
* The queue drive connection
2 changes: 1 addition & 1 deletion config/security.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
],

/**
* When using token. This is the life time of a token.
* When using token. This is the lifetime of a token.
* It is strongly advised to program with tokens.
*/
'token_expirate_time' => 50000
3 changes: 0 additions & 3 deletions config/storage.php
Original file line number Diff line number Diff line change
@@ -30,11 +30,8 @@
'password' => app_env('FTP_PASSWORD'),
'username' => app_env('FTP_USERNAME'),
'port' => app_env('FTP_PORT', 21),
// The basic folder of the server
'root' => app_env('FTP_STARTROOT', null),
// A `true` to activate a secure connection.
'tls' => app_env('FTP_TLS', false),
// Connection waiting time
'timeout' => app_env('FTP_TIMEOUT', 50)
],

6 changes: 3 additions & 3 deletions config/view.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
return [
/**
* The views directory. It is in this repertory that you will put all your views.
* The views must have the instantion you have defined in 'template_extension'
* The views must have the installation you have defined in 'template_extension'
* if no error will be launched
*/
'path' => __DIR__ . '/../templates',
@@ -17,7 +17,7 @@
* Template supported twig, php, tintin
* Define the template name.
* Example: define twig with package twig/twig for define twig template
* Bow Framework support actualy twig, tintin, php
* Bow Framework support actually twig, tintin, php
*/
'engine' => 'tintin',

@@ -36,7 +36,7 @@
/**
* Additional option
*/
'aditionnal_options' => [
'additional_options' => [
// 'auto_reload_cache' => true
]
];
19 changes: 8 additions & 11 deletions frontend/js/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* import Vue from "vue"
* import Example from "./Example.vue"
*/
// import Vue from "vue"
// import Example from "./Example.vue"

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@@ -16,10 +15,8 @@ if (token) {
*/
require('./Example.jsx');

/*
* Vue.component('example', Example);
*
* new Vue({
* el: "#main"
* });
*/
// Vue.component('example', Example);

// new Vue({
// el: "#main"
// });
18 changes: 9 additions & 9 deletions frontend/sass/app.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import "variables";

#main {
position: relative;
margin: 10% auto;
width: 550px;
text-align: center;
font-family: $font-family;
}
@use "variables";

#main {
position: relative;
margin: 10% auto;
width: 550px;
text-align: center;
font-family: $font-family;
}
57 changes: 27 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
{
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"format": "composer run-script lint"
},
"dependencies": {
"axios": ">=0.21.1",
"babel-loader": "^8.0.4",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"css-loader": "^2.0.2",
"jquery": "^3.2",
"laravel-mix": "^6.0.49",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"resolve-url-loader": "^5.0.0",
"sass": "^1.15.2",
"sass-loader": "^7.1.0",
"vue": "^2.5.17"
},
"devDependencies": {
"@babel/preset-react": "^7.0.0",
"vue-template-compiler": "^2.5.21"
}
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.7.9",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.17.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.18.2",
"vite": "^6.0.5"
}
}
Binary file added public/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/img/logo.svg

This file was deleted.

2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

// Register The Auto Loader
if (!file_exists(__DIR__ . "/../vendor/autoload.php")) {
die("Please install the depencencies with 'composer update'");
die("Please install the dependencies with 'composer update'");
}

require __DIR__."/../vendor/autoload.php";
7 changes: 7 additions & 0 deletions seeders/_database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

$users = require __DIR__ . "/users.php";

$seeders = array_merge($users);

return $seeders;
3 changes: 1 addition & 2 deletions seeders/users.php
Original file line number Diff line number Diff line change
@@ -4,11 +4,10 @@
use App\Models\User;

/**
* The users tabler seeder
* The users table seeder
*
* @see https://fakerphp.github.io for all documentation
*/

$faker = Factory::create();

$seeds = [];
13 changes: 7 additions & 6 deletions templates/layouts/default.tintin.php
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
<link rel="icon" type="image/x-icon" href="/favicon.png"/>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;600&display=swap" rel="stylesheet">
<title>%inject('title', 'It\'s Worked')</title>
<style type="text/css">
<title>%inject("title", "It's Worked")</title>
<style>
* {
margin: 0;
padding: 0;
@@ -21,8 +21,8 @@
body {
font-family: 'Montserrat', sans-serif;
color: #333333;
background-color: #f7fafb;
color: #fff;
background-color: #181818;
}
#main {
@@ -40,8 +40,9 @@
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #fff;
background-color: rgba(0, 0, 0, 0.05);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
color: white;
}
.banner img {
@@ -91,7 +92,7 @@
}
h1 {
color: #111;
color: white;
font-size: 42px;
font-weight: 600;
line-height: 1.8;
9 changes: 3 additions & 6 deletions templates/welcome.tintin.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
%extends('layouts.default')

%block('title', 'It\'s Worked')
%block('title', "It's Worked")

%block('content')
<div class="banner">
<img src="/img/logo.svg" alt="">
<img src="/img/logo.png" alt="">
<h1>Bow Framework</h1>
<p>I'm a bow application, you can see my <a href="https://bowphp.com" target="_blank">documentation</a>.</p>
</div>
@@ -15,11 +15,8 @@
<a href="https://akiltechnologies.com/">
<img src="https://www.akiltechnologies.com/wp-content/uploads/2022/07/logoakil.png" alt="akiltechnologie">
</a>
<a href="https://snapdevhq.com/">
<a href="https://github.com/papacandco">
<img src="https://avatars.githubusercontent.com/u/94787620?s=400&u=eb5a8540cbd56914443c8518f24d6e2a967d69c3&v=4" style="width: 50px" alt="Snapdev Côte d'ivoire">
</a>
<a href="https://www.etudesk.com/">
<img src="https://www.etudesk.com/images/logo.png" alt="etudesk">
</a>
</div>
%endblock
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

// Register The Auto Loader
if (!file_exists(__DIR__ . "/../vendor/autoload.php")) {
die("Please install the depencencies with 'composer update'");
die("Please install the dependencies with 'composer update'");
}

require __DIR__ . "/../vendor/autoload.php";
6 changes: 6 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
plugins: [react()],
});
4 changes: 0 additions & 4 deletions webpack.mix.js

This file was deleted.

0 comments on commit aee1446

Please sign in to comment.