Coder Social home page Coder Social logo

juicyfx / vercel-examples Goto Github PK

View Code? Open in Web Editor NEW
287.0 7.0 139.0 16.25 MB

๐Ÿ“ฆ Example projects using Vercel platform. Using Node.js, PHP and others.

Home Page: https://f3l1x.io

License: MIT License

PHP 98.80% HTML 0.87% Makefile 0.06% JavaScript 0.01% CSS 0.01% Vue 0.22% Blade 0.03%
juicyfx runtimes php nodejs vercel examples sample template

vercel-examples's Introduction

Examples & Sample Projects for Vercel

๐Ÿ“ฆ Included examples of PHP Runtime (vercel-php).

๐Ÿ•น f3l1x.io | ๐Ÿ’ป f3l1x | ๐Ÿฆ @xf3l1x


โš™๏ธ Usage

  1. Clone repository git clone [email protected]:juicyfx/vercel-examples.git.
  2. Browse single example, cd /php.
  3. Deploy to Vercel, vercel.

๐Ÿš€ Click & Go

Fastest way how to deploy example project is using following deploy button. It deploys you example PHP project.

๐Ÿ“ฆ Examples

Example Description Demo Deploy
PHP Static frontend with PHP function. ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Composer Install dependencies using Composer ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Laminas Laminas components and MVC ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Laravel Laravel - The PHP Framework For Web Artisans ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Lumen Lumen - PHP Micro-Framework By Laravel ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Nette Tracy Tracy Debugging Tools by Nette. ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Phalcon Phalcon Framework: High Performance PHP Framework ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Satis Composer Satis ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Slim Slim Framework ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Sqlite PHP + SQlite ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Symfony Micro (vol1) Symfony with MicroKernelTrait ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ
PHP - Symfony Micro (vol2) Symfony with MicroKernelTrait ๐Ÿ‘€๐Ÿ•ถ โ–ฒโ–ฒโ–ฒ

๐Ÿ“ License

Copyright ยฉ 2019 f3l1x. This project is MIT licensed.

vercel-examples's People

Contributors

chrillep avatar dependabot[bot] avatar f3l1x avatar irving-caamal avatar nberlette avatar nettum avatar rolandihms avatar vinkla avatar willyarisky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vercel-examples's Issues

new symfony project

Bug report

moved from: vercel-community/php#415

Description

I try to start new symfony project. I found an example: https://github.com/juicyfx/vercel-examples/tree/master/php-symfony-micro1
But it seems to be outdated, and then I took laravel as a base for vercel.json - https://github.com/juicyfx/vercel-examples/tree/master/php-laravel
It builds and deployed to vercel, but unfortunately there is some problem with composer files. Actual I tried both configs, and resulting one is added in that commit: nosovk/symfony-vite@dd83860

But anyway it seems that autoload.php somehow broken.

Update name

Could we update the name of this repo to vercel-php-examples? And could you please remove ZEIT Now from the description? ๐Ÿ™ Thank you!

Codeigniter 4 ???

Feature Request

Can upload or pull a example with codeigniter 4 ?

or the same example of codeigniter 3 work with codeigniter 4??

Thank you

Execute artisan command(s)

How to execute artisan command in vercel using this?

I need to execute php artisan migrate command after the dependencies have been installed.
I've tried using composer scripts but it doesn't seem to work properly.

I'm using vercel's postgresql database and I've already set the credentials in the environment variables.

Is there any way to execute artisan command?

[laravel] Blade template compiling not saving in tmp folder

Bug report

Description

file_put_contents(/tmp/views/0f90093f751a3f4d993fa01cf5fee7b3bb0734ca.php): failed to open stream: No such file or directory

I'm unsure if blades in general aren't supported, but I'm trying to have blades compile instead of using a SPA. Here's my now.json conifg:

{
  "version": 2,
  "functions": {
    "api/index.php": {
      "runtime": "[email protected]"
    }
  },
  "routes": [
        {
            "src": "/(.*)",
            "dest": "/api/index.php"
        }
  ],
  "env": {
    "APP_NAME": "Vercel Laravel",
    "APP_KEY": "REDACTED",
    "APP_ENV": "local",
    "APP_DEBUG": "true",
    "APP_URL": "https://php-laravel.vercel.app",
    "VERCEL_DEMO_MODE": "true",
    "APP_CONFIG_CACHE": "/tmp/config.php",
    "APP_EVENTS_CACHE": "/tmp/events.php",
    "APP_PACKAGES_CACHE": "/tmp/packages.php",
    "APP_ROUTES_CACHE": "/tmp/routes.php",
    "APP_SERVICES_CACHE": "/tmp/services.php",
    "CACHE_DRIVER": "array",
    "LOG_CHANNEL": "stderr",
    "SESSION_DRIVER": "array",
    "VIEW_COMPILED_PATH": "/tmp/views",
    "SSR_TEMP_PATH": "/tmp/ssr",
    "NODE_PATH": "node"
  }
}

Bump PHP Version to [email protected]

Description

We need to update the PHP version used in our project to "[email protected]" to take advantage of the latest improvements and bug fixes. This change is essential for maintaining the performance and security of our application.

Expected Behavior:

The application in vercel should continue to function correctly with the updated PHP version, and we should see improvements in performance and stability.

Additional Information:

Any specific considerations or dependencies related to this PHP version update.
Any potential risks or issues that need to be addressed during the update.
Any relevant documentation or links.

After changing api route path it is not working after deployed on vercel

Bug report

I have server like "api.xxx.dev/backend/..." I have changed prefix backend to api
New path is "api.xxx.dev/api/.."

It is not working on development server getting 404 response code
but If I am using "api.xxx.dev/index.php/api/.." It is working on server

and I need to remove index.php from url

My Routeserviceprovide is

Route::middleware('api')
->prefix('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));

And my .htaccess file is

Options -MultiViews -Indexes
RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index.php/(.+) /$1 [R=301,L]

Is there any required thing to do on vercel?

Setup Laravel

Question

Hi what do I have to do to deploy my existing project on vercel?

Laminas doesn't deploy at all

Bug report

  • Example: Laminas throws an error about libssl when trying to deploy the preset to Vercel
  • URL: No
  • Repository: No

Description

image

ERROR: DEPLOY TO LARAVEL

Bug report

ERR

Screenshot from 2024-05-03 17-46-14

File vercel.json

Screenshot from 2024-05-03 17-44-56

Description

  • Where is the "/var/task/user/storage/logs/laravel.log" folder and is it not in my project folder?

PROJECT:

  • laravel 10
  • vue 3
  • php 8.1

Please help me. Thanks everyone

Error with Symfony

Bug report

Description

Fatal error: Uncaught RuntimeException: Unable to create the "cache" directory (/var/task/user/var/cache/prod). in /var/task/user/vendor/symfony/http-kernel/Kernel.php:623 Stack trace: #0 /var/task/user/vendor/symfony/http-kernel/Kernel.php(532): Symfony\Component\HttpKernel\Kernel->buildContainer() #1 /var/task/user/vendor/symfony/http-kernel/Kernel.php(131): Symfony\Component\HttpKernel\Kernel->initializeContainer() #2 /var/task/user/vendor/symfony/http-kernel/Kernel.php(191): Symfony\Component\HttpKernel\Kernel->boot() #3 /var/task/user/public/index.php(28): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 /var/task/user/api/index.php(3): require('/var/task/user/...') #5 {main} thrown in /var/task/user/vendor/symfony/http-kernel/Kernel.php on line 623

Error: The Serverless Function "api/index" is 68.16mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size

Running into the above error. Steps to reproduce:

  1. Clone example https://github.com/juicyfx/vercel-examples/tree/master/php
  2. Update runtime to [email protected] in vercel.json
  3. Attempt to deploy

This is my first time using Vercel, sorry if I am missing something basic.

Here is the full output from Vercel

[13:58:13.793] Cloning github.com/***************************** (Branch: *************, Commit: *******)
[13:58:16.783] Cloning completed: 2.990s
[13:58:16.938] Restored build cache
[13:58:16.993] Running "vercel build"
[13:58:17.592] Vercel CLI 28.12.7
[13:58:17.782] > Installing Builder: [email protected]
[13:58:21.951] ๐Ÿ˜ Downloading user files
[13:58:21.952] ๐Ÿ˜ Downloading PHP runtime files
[13:58:21.971] ๐Ÿ˜ Creating lambda
[13:58:22.367] Build Completed in /vercel/output [420ms]
[13:58:28.894] Failed to process build result for "api/index". Data: {"type":"Lambda"}.
[13:58:28.897] Error: The Serverless Function "api/index" is 68.16mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size

[laravel] could not find driver with sqlite3

Bug report

  • Example: No
  • URL:No
  • Repository: No

Description

I set the DB drive config to sqlite ,

.env:
DB_CONNECTION=sqlite
DB_DATABASE=D:\repo\php-laravel\database\database.sqlite

or

now.json:
"DB_CONNECTION": "sqlite",
"DB_DATABASE": "D:\repo\php-laravel\database\database.sqlite"

But the console told me the warning when I use the php artisan migrate command:

Illuminate\Database\QueryException 

could not find driver (SQL: select * from information_schema.tables where table_schema = forge and 
table_name = migrations and table_type = 'BASE TABLE')

I can use sqlite as a database in a brand new laravel application.

How to use Cache::set('key', 'test'); with CACHE_DRIVER=file?

How to use Cache::set('key', 'test'); with CACHE_DRIVER=file?
I change to /tmp/ , no errors, but the cache function seems not work. each trigger always fetch from DB.

        'file' => [
            'driver' => 'file',
            'path' => storage_path('framework/cache/data'),
        ],

==>

        'file' => [
            'driver' => 'file',
            'path' => '/tmp/framework/cache/data',
        ],

thanks.

API Platform / Symfony 6 API workaround

Hello, I encounter a problem with API Platform and Vercel, I tried many things and nothing seems to work.

What I have :

  • API Platform project, based on Symfony 6
  • api folder created to allow serverless function on Vercel (the index.php file contains the exact same thing as the public/index.php file)
  • vercel.json with the following content :
{
    "functions": {
      "api/index.php": {
        "runtime": "[email protected]"
      }
    },
    "routes": [
      { "src": "/bundles/(.*)", "dest": "/public/bundles/$1" },
      { "src": "/(.*)", "dest": "/api/index.php" },
      { "src": "/api/(.*)", "dest": "/api/index.php" }
    ],
    "env": {
      "APP_ENV": "dev",
      "APP_SECRET": "b2b9b5f9ae35ad900c9c25605e210aad"
    }
}

When I try to access SwaggerUI (on myurl.vercel.app/api, it's kinda working (no assets but I know why and won't fix it since SwaggerUI won't go in production), but when I try to request the API, it just returns No route found.

I don't know what I'm doing wrong, but it's driving me crazy. Can you help me please ?

Thanks !

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.