I just cant! NextJS?
Personal preference determines the choice of technology stack, this is normal! I personally don't prefer Next.js. Its single-language argument doesn't apply to me. I prefer to develop in multiple languages.
I have developed many React applications, but now I don’t use React very often. Currently I mainly use Go (Echo or Fiber), Django and Laravel (Go is my favorite language!).
Recently I needed to build a small app, consisting mainly of CRUD operations, with some dynamic functionality... I considered trying Next.js. I briefly built an application with Next.js a year ago, so I have a general understanding of the framework.
It turned out to be a painful experience!
I spent about an hour trying to use: https://www.php.cn/link/b0eec27361a2a03d4480b560df531df7
The documentation sucks! It assumes you deploy to Vercel. I just want to run it locally.
Anyway, I decided to try it from scratch...
I created a blank Next.js project with almost nothing in it! I had to set up Drizzle manually and even copy-pasting the code from the documentation didn't quite work.
I ran into some annoying bugs that I can't remember now, but all in all I had to read the logs and debug it myself, which is a blur on my memory.
To be fair, I’m already rusty, it’s my technical issues.
Next.js is just a router and cache
I don’t quite understand the point of Next.js, it’s just a meta-framework with router and caching built in. You can use Inertia for routing, skip all the tedious setup, and use React as usual.
My previous experience of using React in SPA made me hate SPA. It was painful to deal with routing and Redux. I prefer to use a backend router and do minimal state management in React itself.
Next.js solves this problem to some extent, but I feel it is not complete enough and is too coupled to Vercel.
Laravel Backpack saved me!
Time is tight, I need to complete the task, there is no time to worry. Maybe I'll try Next.js again in the future, but at that point, getting the project done quickly is crucial.
In 5 minutes I built a complete admin panel, including authentication! Just run a few CLI commands.
Since Backpack uses Laravel as its base, creating database tables is very easy. Just run:
<code>php artisan make:model Project -m</code>
This sets up the model and migration files for me. I just need to add my database fields in the migration file and run:
<code>php artisan migrate php artisan backpack:crud Project</code>
With 3 commands in total, I got a fully usable CRUD interface with search and sort capabilities.
Next, I need to handle some background tasks, such as sending emails and queuing tasks for later processing.
<code>php artisan make:model Project -m</code>
In order to make the Redis queue mechanism work normally, I only need a SystemCTL task:
<code>php artisan migrate php artisan backpack:crud Project</code>
To be honest, Laravel sometimes makes me annoyed because they continue to add functions, causing the framework to become very bloated now.
This is why I like the minimalist style of Next.js, but I think it is too extreme to me.
A framework should be worn at least from the router, database layer and queue, because almost all complex applications need these functions.
This depends on your experience. The convenience brought by Laravel may not always be good. Personally, before Laravel appeared, I had built an over -authentication system and framework from scratch, so re -inventing the wheel was a bit boring. What is the significance?
The above is the detailed content of I just cant! NextJS?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The enumeration function in PHP8.1 enhances the clarity and type safety of the code by defining named constants. 1) Enumerations can be integers, strings or objects, improving code readability and type safety. 2) Enumeration is based on class and supports object-oriented features such as traversal and reflection. 3) Enumeration can be used for comparison and assignment to ensure type safety. 4) Enumeration supports adding methods to implement complex logic. 5) Strict type checking and error handling can avoid common errors. 6) Enumeration reduces magic value and improves maintainability, but pay attention to performance optimization.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

RESTAPI design principles include resource definition, URI design, HTTP method usage, status code usage, version control, and HATEOAS. 1. Resources should be represented by nouns and maintained at a hierarchy. 2. HTTP methods should conform to their semantics, such as GET is used to obtain resources. 3. The status code should be used correctly, such as 404 means that the resource does not exist. 4. Version control can be implemented through URI or header. 5. HATEOAS boots client operations through links in response.

In PHP, exception handling is achieved through the try, catch, finally, and throw keywords. 1) The try block surrounds the code that may throw exceptions; 2) The catch block handles exceptions; 3) Finally block ensures that the code is always executed; 4) throw is used to manually throw exceptions. These mechanisms help improve the robustness and maintainability of your code.

The main function of anonymous classes in PHP is to create one-time objects. 1. Anonymous classes allow classes without names to be directly defined in the code, which is suitable for temporary requirements. 2. They can inherit classes or implement interfaces to increase flexibility. 3. Pay attention to performance and code readability when using it, and avoid repeatedly defining the same anonymous classes.
