Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel/UI Vue Preset Enhancement and optimizations #255

Closed
wants to merge 4 commits into from

Conversation

Nejcc
Copy link

@Nejcc Nejcc commented Nov 20, 2023

This pull request introduces optimizations and enhancements to the Vue preset class in Laravel, ensuring compatibility with PHP 8.2. The key focus was on improving the maintainability, readability, and overall structure of the Vue preset class, aligning it with PHP 8.2 standards, and adding new functionalities to the Vue setup.

Changes Made

PHP Code Optimizations

  • Enhanced type declarations for better clarity and type enforcement.
  • Implemented a private static method copyFileIfNotExists to reduce redundancy in file copying operations.
  • Simplified existing methods by utilizing the newly added copyFileIfNotExists method, leading to a cleaner and more maintainable codebase.
  • Ensured that all changes are backward compatible and do not introduce breaking changes to existing functionalities.

JavaScript File Additions and Modifications

  • New Files Added:

    • registerPlugins.js: Handles the registration of Vue plugins.
    • registerComponents.js: Manages the registration of global Vue components.
    • registerGlobalMethods.js: Responsible for registering global methods in Vue.
  • Modifications to app.js:

    • Incorporated the newly added JavaScript files (registerPlugins.js, registerComponents.js, and registerGlobalMethods.js) while maintaining the existing structure of app.js.
    • Enhanced app.js to include additional functionalities provided by the new JavaScript files, improving the Vue setup within Laravel.

Benefits to End Users

  • Maintainability and Readability: Refactoring makes the Vue preset class more maintainable and easier to understand, facilitating future enhancements and bug fixes.
  • PHP 8.2 Compatibility: Ensures that Laravel's Vue preset class remains up-to-date with PHP 8.2, benefiting developers using the latest PHP version.
  • Enhanced Vue Setup: The added JavaScript files and modifications to app.js provide more functionality and flexibility in managing Vue components and methods, enhancing the Vue integration within Laravel applications.
  • Non-Breaking Changes: Carefully crafted changes to avoid any breaking changes, ensuring a seamless update process.

Compatibility with Existing Features

  • Optimizations and new JavaScript files do not alter the existing functionality of the Vue preset class.
  • Changes have been tested to ensure they do not break any existing features in Laravel.

Making Web Application Development Easier

  • Clean, maintainable, and up-to-date codebase makes managing Vue integration within Laravel applications easier, reducing the potential for bugs and simplifying the customization process.

Updating Your Laravel Application with Enhanced Vue Functionality (manualy)

This guide provides step-by-step instructions on how to update your existing Laravel application to include the enhanced Vue functionality. This update assumes that laravel/ui is already installed in your Laravel application.

Step 1: Create New JavaScript Files

First, you'll need to create three new JavaScript files for handling Vue plugins, components, and global methods.

  1. Create registerPlugins.js File

    • Path: resources/js/registerPlugins.js
    • Purpose: Handles the registration of Vue plugins.
    • Action: Create this file and include the logic for registering Vue plugins.
  2. Create registerComponents.js File

    • Path: resources/js/registerComponents.js
    • Purpose: Manages the registration of global Vue components.
    • Action: Create this file and add the code for globally registering Vue components.
  3. Create registerGlobalMethods.js File

    • Path: resources/js/registerGlobalMethods.js
    • Purpose: Responsible for registering global methods in Vue.
    • Action: Create this file and implement the global methods registration logic.

Step 2: Update app.js

Modify the app.js file to incorporate the new JavaScript files.

  • Path: resources/js/app.js
  • Action: Update the file to import the new JavaScript files and use their functionalities. Ensure that the structure of app.js remains consistent with the existing setup.

Step 3: Update Vue Components (Optional)

If you have existing Vue components, you may want to update them to utilize the newly registered plugins, components, or methods.

  • Action: Refactor your Vue components as needed. This might involve using the newly available global components, registerComponents or registerPlugins methods.

Step 4: Compile Your Assets

After making these changes, you'll need to compile your assets.

  • Run npm install to ensure all dependencies are installed.
  • Run npm run dev or npm run production to compile your assets.

Step 5: Test Your Application

Thoroughly test your application to ensure that the new Vue functionalities are working as expected and that there are no regressions.

  • Action: Perform manual testing and run any automated tests you have.

Conclusion

By following these steps, you should have successfully updated your Laravel application with enhanced Vue functionality, making your Vue integration more powerful and maintainable.


I believe these changes will greatly benefit the Laravel community and align with the framework's commitment to excellence in modern web application development.

Thank you for considering this contribution.

Best regards,
Nejcc

@driesvints
Copy link
Member

Thank you for the PR but please see the readme. This package is no longer being developed and is simply maintained for BC reasons.

@driesvints driesvints closed this Nov 20, 2023
@Nejcc
Copy link
Author

Nejcc commented Nov 20, 2023

Thank you for the PR but please see the readme. This package is no longer being developed and is simply maintained for BC reasons.

Is there any other alternative for vue/auth ? @driesvints

@driesvints
Copy link
Member

Hey @Nejcc, yes we recommend our newer and more modern package Breeze: https://www.bakkerijhaerens.be/be-nl/bakkerij-haerens/category/57502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants