Code Monkey home page Code Monkey logo

catlink's Introduction

๐Ÿฑ๐Ÿ”— catlink โ€“ Categorized Links, for methodical people.

If you want spend less time and less mental energy every day, we are creating a simple but powerful web tool to archive, search and share useful information with your small community of smart people.

Architecture

This project is based on:

Category VS Tag

If you see the way normally used to tag links, it is really too confusing for me: casual words in casual order.

A hierarchical categories system is much clearer and allow you to search starting from the generic (on the left) to the details (on the right), for example:

/๐Ÿ‡บ๐Ÿ‡ธus/New York/job/programmer

or vegan restaurant at Milan city:

/๐Ÿ‡ฎ๐Ÿ‡นit/Milano/ristorante/vegano

โš ๏ธ Remember to use always singular name for the category.

Laravista Dockerfile

This project uses PHP Docker official image for local development.

docker build -t laravista .
docker run -d --rm -p 80:80 -v "$PWD/src":/var/www/html --name running laravista
docker exec -it running bash

Into the container we already execute:

composer create-project laravel/laravel CatLink

so you have the Laravel framework code here but without the /vendor folder with the libraries (dependencies) because configured into the .gitignore file.

To get the dependencies:

root@a8b86019f174:/var/www/html# cd CatLink/
root@a8b86019f174:/var/www/html/CatLink# composer install

and when completed try http://127.0.0.1/CatLink/

Without .htaccess was http://127.0.0.1/CatLink/public/

At the end use this:

docker stop running

Apache .htaccess

We added this /CatLink/.htaccess file:

AddHandler av-php82 .php

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /CatLink
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

to avoid to expose the .env file here http://127.0.0.1/CatLink/.env

and we updated the routes:

Route::get('/CatLink', function () {
    return view('welcome');
});

AddHandler av-php82 .php is useful only in production (for AlterVista) but you can keep it in development.

Release with ZIP

You have to go into src folder and execute:

zip -r CatLink.zip CatLink

Now you can upload the archive using the AlterVista web panel for administrators.

Try this https://laravista.altervista.org/CatLink/

MySQL

You have to create your local database for example named laravel and configure it into .env

DB_CONNECTION=mysql
DB_HOST=host.docker.internal # This works on macOS
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=pass

About DB_HOST read more info here

AlterVista database is not accesible from your machine, but works only on the production server using this configuration:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=my_laravista
DB_USERNAME=laravista
DB_PASSWORD=

After you release this configuration in production, you can not execute migration commands from a console but you can from the web routes/web.php

Route::get('/CatLink/artisan/migrate', function () {
    Artisan::call('migrate');
    return Artisan::output();
});

(before continue we have to FIX the issue #1 with the new version of PHP configured on AlterVista)

at the end you could make this test:

Route::get('/CatLink/test', function () {
    return \App\Models\User::all();
});

Command app:prepare {env}

This command help you to prepare a specific environment (prod, dev)

root@504f54a78618:/var/www/html/CatLink# php artisan app:prepare dev
Preparing dev ...
Done!

root@504f54a78618:/var/www/html/CatLink# php artisan app:prepare prod
Preparing prod ...
Done!

Roadmap

See into docs/releases folder

catlink's People

Contributors

rognoni avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

catlink's Issues

Undefined variable $pipes

When you execute Artisan::call('migrate') from web, on AlterVista (shared hosting)

Route::get('/CatLink/artisan/migrate', function () {
    Artisan::call('migrate');
    return Artisan::output();
});

because the PHP 8.2 function proc_open exists and returns false (was all ok with PHP 7.3)

PHP 7.3 function_exists('proc_open') --> FALSE
PHP 8.2 function_exists('proc_open') --> TRUE

but this is a problem here:

// vendor/symfony/console/Terminal.php:220
private static function readFromProcess(string|array $command): ?string
{
    if (!\function_exists('proc_open')) {
        return null;
    }

    $descriptorspec = [
        1 => ['pipe', 'w'],
        2 => ['pipe', 'w'],
    ];

    $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;

    $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
    if (!\is_resource($process)) {
        return null;
    }

    $info = stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    fclose($pipes[2]);
    proc_close($process);

    if ($cp) {
        sapi_windows_cp_set($cp);
    }

    return $info;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.