We are using https://github.com/DarkaOnLine/L5-Swagger in our Laravel project.
Currently we add all annotations directly to the controller, it is ok but, makes code bit messy. I was wondering what are the best practices? Maybe it is better to keep annotations in separated file?
Some one can share code example how to keep annotations in separated file?
Thanks!
Related
I have a complete working Website in Laravel 5.1 and want to Migrate the entire code into ASP.NET MVC 5.x. Is there any easy way to do this? Thanks
Simple answer NO.
Long answer:
Learn ASP.net if you don't already know it
Code the website according to what you need
Note: There is no copy-paste solution, if that's what your looking for. I don't think anyone will create something to 'translate' a laravel (php) to asp.net
There are options to help you along the way:
1.Migrating from PHP to ASP.NET
2.Migration assistants
3.Online conversion
As you can see there are helpers, but I wouldn't rely on them. As you might already know mvc works with different folders, controllers, models, views etc. The conversion tools won't exactly know how to deal with them, so you will have to edit them afterwards, which might take you more time to get a grip on how and what was converted in stead of just coding it all over.
So to "convert" a laravel website it would at least require that you convert all files in your laravel project folder. Just thinking about it, I wouldn't want to go that route.
i'm looking at a tutorial which let me learn and make a webservice in REST using PHP to communicate a JSON to my iOS application.
I don't find any "good" tutorial or a tutorial which make me learn and create something which look like a bit like i want.
could you please help me and put me in the good direction ^^
Thanks guys !
Client
For the client side I would suggest you use RestKit which is a very convenient framework for consuming REST-based webservers. It works for XML And JSON. I have used it before and can definitely recommend it. There are also various examples, which shows you how to use the framework.
Server
Depending on what you want you might do one of the following options:
Easy: If you want to focus more on the client you can simply put your .json files in a folder in your Public folder of your dropbox and consume those data files. You can then make changes to them with the Text Editor of your choice
If you want to have more control and have a Database etc. I suggest using CakePHP, which is like Rails for PHP. You have a bit of a learning curve there but the framework is quite powerful and there are lots of resources out there. Like Rails it follows the MVC Paradigm.
Update:
I just stumbled upon a nice step-by-step tutorial for the iPhone which loads json-based twitter-data and displays it in a UITableView
I'm trying to get a UI using MVC. I'm currently battling with MVC3. There does’nt seem to be much documentation.
Here’s what I’m thinking. I believe I need to create stored procs for each query. I’m creating the the LINQ to SQL for the model. I’m trying to figure out how to create the cotroller. Any suggestion on how to input data to the stored proc and return results to the view? The default controller classes dont seem to do anything
Am I doing this right? Or MVC2/MVC1 the easier way to go?
I'm new to MVC on .NET. Thanks in advance.
There is plenty of documentation, if you look for it... Also, http://www.asp.net/mvc is a good place to start.
What it seems like you really need documentation for is LINQ-to-SQL, not MVC, which is here: http://msdn.microsoft.com/en-us/library/bb425822.aspx
There's also a great ScottGu tutorial here: http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx
The whole series is available here, including a PDF download: http://scottonwriting.net/sowblog/archive/2010/07/27/links-to-scott-guthrie-s-using-linq-to-sql-tutorials.aspx
I believe I need to create stored procs for each query.
You could do this but it might be an overkill. I would recommend you watching the tutorials here. Paragraph 5. covers tutorials about using Entity Framework for data access. Try them out and if you encounter some specific issues don't hesitate to ask a question by showing what you have tried and what didn't work for you.
If you're using Linq to SQL, you don't need to use Stored Procs at all.
If you want more information on MVC generally, try doing the NerdDinner example.
I am building a CMS using Ruby on Rails to teach myself the framework. One thing I am trying to work out and can't find resources for is how to build it in a modular format (By this I don't mean Ruby modules, but like the style of Zend Frameword Modules)
so for example:
App : Admin : Controllers
: Views
: Models
: Pages : Controllers
: Views
: Models
: Localisation : Controllers
: Views
: Models
Now I know that there may be a different way to achieve this, but I guess my specific aims are for easy separation of different parts and easy drop in/out, so for example a localisation module could be dropped in to achieve specific extra functionality for localisation etc.
Edit:
I am not trying to build this in the same way as ZF, however I am assuming there is some way to organise sections of the site. I am trying to work out what RoRs answer to this kind of 'problem' is. I am just using ZF as an example.
My best bet would be to use Rails Engines. They are built to be drop-in modules including views, controllers and models. Basically a way to include a Rails-application into another.
Trying to build an application in one framework the way another framework does it defeats the purpose. It is a nice inclination to want to do that but you are doing yourself no favors by doing so. Rather you should apply your experience to learn how RoR really works, what it's conventions are and then adjust your thinking and approach to solving the problems at hand accordingly.
I've been wondering about best practices on creating a project in MVC, and let others create extension/modules/plugins and skins/themes etc, for it.
For example WordPress is great at this. Just upload a file or folder. Or even browse the plugins directly from your WP administration and install by a simple click.
Does anybody here have a few tips on how to create a project that allows that flexibility.
For the skins I might need to implement my own viewengine, right?
Any good resources and tips would be great.
Thanks!
Skinning isn't that hard, just swap stylesheets. For using a different set of templates, yes, you'd need just customize, not write your own, viewengine. This is pretty easy and all you'd have to do is tell MVC to look in different places for your views:
http://www.dotnetguy.co.uk/post/2010/01/31/ASPNET-MVC-e28093-Dynamically-Changing-The-Master-Page-(Theming).aspx
The MVC plugins widgets question has been asked before:
https://stackoverflow.com/questions/2230482/asp-net-mvc-2-widgets/2230833#2230833
I ended up using a VirtualPathProvider since I wanted the views outside of the application. Now, we made it possible for the views to be stored in the database.